forked from xmail-client/xmail
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun
More file actions
executable file
·38 lines (30 loc) · 1 KB
/
run
File metadata and controls
executable file
·38 lines (30 loc) · 1 KB
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
#!/usr/bin/env node
var path = require("path");
var spawn = require("child_process").spawn;
require('./utils/config')
var pkgInfo = require(path.resolve(__dirname, '..', 'package.json'));
var target = path.resolve(__dirname, '..', 'dist/');
var theArgs = process.argv.slice(2);
if (theArgs.length < 1) {
theArgs = ['-r', path.resolve('.')];
}
// Linux
var cmd = path.join(target, pkgInfo.productName, pkgInfo.productName);
if (process.platform === 'darwin') {
cmd = path.join(target, pkgInfo.productName + '.app', 'Contents', 'MacOS', pkgInfo.productName);
}
if (process.platform === 'win32') {
cmd = path.join(target, pkgInfo.productName, pkgInfo.productName + '.exe');
}
var toRun = cmd + " " + theArgs.join(" ");
console.log("Running: " + toRun);
var child = spawn(cmd, theArgs);
child.stdout.on('data', function(data) {
console.log(data.toString());
});
child.stderr.on('data', function(data) {
console.error(data.toString());
});
child.on('close', function(exitValue) {
process.exit(exitValue);
});