node-worker icon indicating copy to clipboard operation
node-worker copied to clipboard

Raise "close" event when worker processes terminate

Open chrisboulton opened this issue 14 years ago • 1 comments

Updated pull request that contains alignment fixes, unit tests and usage instructions. Strangely I wasn't able to append the pull request to the existing one.

It'd be incredibly useful to be able to tell when a worker process terminates, to for example spawn a new one, or just log the completion of the process. This patch adds an event that is raised along with the exit code from the process. It does not apply to TCP workers just yet.

Usage:

worker.addListener('close', function(code) {
    console.log('Worker child exited with ' + code);
});

chrisboulton avatar Sep 05 '10 08:09 chrisboulton

cramforce, any updated thoughts on this?

chrisboulton avatar Oct 01 '10 23:10 chrisboulton