Created
March 28, 2018 08:06
-
-
Save XaroRSA/2195073df4710e3a1b079c2945731c72 to your computer and use it in GitHub Desktop.
Spawn in new Windown on linux?
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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