Created
May 11, 2016 14:33
-
-
Save pibi/d6c90e23a9224164893cbe6882bc8b5c to your computer and use it in GitHub Desktop.
Child Process survival test for node
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
setInterval(function () { | |
console.log(Date.now()); | |
}, 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
const spawn = require('child_process').spawn; | |
const os = require('os'); | |
//child doesn't exit on windows, for linux we should use stdio:'ignore' | |
const child = spawn('node', ['interval'], { detached: true, stdio: (os.type() !== 'Windows_NT')? 'ignore' : null}); | |
child.unref(); |
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
const spawn = require('child_process').spawn; | |
const child = spawn('node', ['interval'], { stdio: 'inherit' }); |
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
const spawn = require('child_process').spawnSync; | |
const child = spawn('node', ['interval']); |
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
const spawn = require('child_process').spawnSync; | |
const child = spawn('node', ['interval'], { stdio: 'inherit' }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment