forked from botwillacceptanything/botwillacceptanything
-
Notifications
You must be signed in to change notification settings - Fork 2
/
launcher.js
45 lines (39 loc) · 1.08 KB
/
launcher.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
(function() {
var spawn = require('child_process').spawn;
var exec = require('child_process').exec;
function startMain(code) {
if (code !== 0) {
return console.error('Failed to NPM install');
}
var child = spawn('node', [__dirname + "/main.js"], {
detached: true,
stdio: 'inherit'
});
child.unref();
process.exit(0);
}
function npmInstall() {
var child = spawn('npm', ['install']);
child.stderr.on('data', function (data) {
console.error('npm install stderr: ' + data);
});
child.on('close', startMain);
}
/**
* Update data/authors.txt by running our shell script.
*/
function updateAuthors(cb) {
try {
exec('./authors.sh', function (err, stdout, stderr) {
if (err || stderr) {
console.error('./authors.sh stderr:', err, stderr);
}
});
}
catch (e) {
console.error('./authors.sh exception:' + e);
}
cb();
}
updateAuthors(npmInstall);
}());