Last active
March 10, 2016 21:22
-
-
Save shirish87/9f66f1a5d730e386717d to your computer and use it in GitHub Desktop.
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('node', ['child.js', 'arg2'], { | |
cwd: process.cwd(), | |
env: process.env, | |
detached: false, | |
stdio: [ 'ignore', 'ignore', 'ignore', 'ipc' ] | |
}) | |
.on('message', function (m) { | |
// console.log('message', m); | |
// child.disconnect(); | |
// child.unref(); | |
}) | |
.on('exit', console.error); | |
setInterval(function () { | |
console.log('args', process.argv); | |
process.send && process.send({ message: 'what' }); | |
}, 1000); |
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('node', ['child.js', 'arg1'], { | |
cwd: process.cwd(), | |
env: process.env, | |
detached: true, | |
stdio: [ 'ignore', 'ignore', 'ignore', 'ipc' ] | |
}) | |
.on('message', function (m) { | |
console.log('message', m); | |
// child.disconnect(); | |
// child.unref(); | |
}) | |
.on('exit', console.error) | |
setInterval(function () { }, 2000); |
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 child = spawn('cmd.exe', [ '/C', 'start', '/B', process.execPath, 'child.js', 'arg1' ], { | |
cwd: process.cwd(), | |
env: process.env, | |
detached: false, | |
windowsVerbatimArguments: true, | |
stdio: ['ignore', 'ignore', 'ignore'] | |
}) | |
.on('exit', console.error); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment