Skip to content

Instantly share code, notes, and snippets.

@AndreasMadsen
Created February 1, 2012 20:10
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 AndreasMadsen/1719044 to your computer and use it in GitHub Desktop.
Save AndreasMadsen/1719044 to your computer and use it in GitHub Desktop.
var fork = require('child_process').fork;
if (process.argv[2] === 'child') {
setInterval(function () {
console.log('alive ... ');
}, 200);
setTimeout(function () {
console.log('exit child');
process.exit(0);
process.exit(0);
}, 500);
} else {
var child = fork(process.argv[1], ['child'], {thread: true});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment