Skip to content

Instantly share code, notes, and snippets.

@XaroRSA
Created March 28, 2018 08:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save XaroRSA/2195073df4710e3a1b079c2945731c72 to your computer and use it in GitHub Desktop.
Save XaroRSA/2195073df4710e3a1b079c2945731c72 to your computer and use it in GitHub Desktop.
Spawn in new Windown on linux?
var spawn = require('child_process').spawn;
var child = spawn('/home/john/.config/myapp/bin/server',['-p','4000']);
child.stdout.on('data', function(data) {
console.log('stdout: ' + data);
//Here is where the output goes
});
child.stderr.on('data', function(data) {
console.log('stderr: ' + data);
//Here is where the error output goes
});
child.on('close', function(code) {
console.log('closing code: ' + code);
//Here you can get the exit code of the script
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment