Created
May 18, 2015 09:39
-
-
Save alessioalex/be4924eab644ad32d033 to your computer and use it in GitHub Desktop.
zombie processes nodejs
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
// http://stackoverflow.com/questions/12871740/how-to-detach-spawned-child-process-in-a-node-js-script | |
// https://nodejs.org/api/child_process.html#child_process_options_detached | |
// var fs = require('fs'); | |
// var out = fs.openSync('./out.log', 'a'); | |
// var err = fs.openSync('./out.log', 'a'); | |
var cp = require('child_process'); | |
// var child = cp.spawn('node', ['zombie.js'], { detached: true, stdio: [ 'ignore', out, err ] }); | |
var child = cp.spawn('node', ['zombie.js'], { detached: true, stdio: [ 'ignore' /* stdin */, 'ignore' /* stdout */, 'ignore' /* stderr */ ] }); | |
child.unref(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment