diff --git a/lib/workers/workerpool.js b/lib/workers/workerpool.js index 5038acb9..b289aa79 100644 --- a/lib/workers/workerpool.js +++ b/lib/workers/workerpool.js @@ -118,8 +118,9 @@ WorkerPool.prototype.spawn = function spawn(id) { child.on('exit', (code) => { this.emit('exit', code, child); - if (this.children.get(child.id) === child) - this.children.delete(child.id); + + if (this.children.get(id) === child) + this.children.delete(id); }); child.on('event', (items) => {