copay/shell/scripts/launch.js

40 lines
912 B
JavaScript
Raw Normal View History

2014-06-06 11:23:40 -07:00
/*
2014-07-07 07:01:52 -07:00
** copay-shell - launch
*/
2014-06-06 11:23:40 -07:00
2014-07-07 07:01:52 -07:00
var color = require('cli-color');
var path = require('path');
var appPath = path.normalize(__dirname + '/../../');
2014-06-06 11:23:40 -07:00
var execPath = path.normalize(__dirname + '/../bin/' + process.platform);
2014-07-07 07:01:52 -07:00
var spawn = require('child_process').spawn;
2014-06-06 11:23:40 -07:00
// update execPath with platform specific binary locations
switch (process.platform) {
case 'linux':
2014-06-06 11:30:07 -07:00
execPath += '/atom';
2014-06-06 11:23:40 -07:00
break;
case 'darwin':
execPath += '/Atom.app/Contents/MacOS/Atom';
break;
case 'win32':
2014-06-09 07:10:56 -07:00
execPath += '\\atom.exe'
2014-06-06 11:23:40 -07:00
break;
default:
console.log('Platform not supported.');
process.exit();
}
var copay = spawn(execPath, [appPath]);
2014-07-07 07:01:52 -07:00
copay.stdout.on('data', function(data) {
2014-07-07 07:08:50 -07:00
console.log("STDOUT:" + data);
2014-06-06 11:23:40 -07:00
});
2014-07-07 07:01:52 -07:00
copay.stderr.on('data', function(data) {
console.log("STDERR:" + data);
2014-06-06 11:23:40 -07:00
});
2014-07-07 07:01:52 -07:00
copay.on('close', function(code) {
2014-06-06 11:23:40 -07:00
console.log('child process exited with code ' + code);
});