Skip to content

Instantly share code, notes, and snippets.

@sam-github
Created August 14, 2013 22:48
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 sam-github/6236471 to your computer and use it in GitHub Desktop.
Save sam-github/6236471 to your computer and use it in GitHub Desktop.
assert = require('assert')
cluster = require('cluster');
if(cluster.isMaster) {
worker=cluster.fork();
worker.on('exit', function(code, signal) {
console.log('worker on exit', code, signal, 'process.exitCode', worker.process.exitCode)
})
worker.on('online', function() {
console.log('worker pid', worker.process.pid)
worker.kill('SIGTERM')
});
} else {
process.on('exit', function() {
console.log('worker, process.on exit...')
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment