From 4e905fa8d5be1ff90895964a7f86401bc2b86462 Mon Sep 17 00:00:00 2001 From: yorkie Date: Sun, 1 May 2016 22:55:05 +0800 Subject: [PATCH] cluster: remove use of bind() in destroy() This commit replaces process.exit.bind() with an arrow function in Worker.prototype.destroy(). PR-URL: https://github.com/nodejs/node/pull/6502 Reviewed-By: Colin Ihrig Reviewed-By: James M Snell --- lib/cluster.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/cluster.js b/lib/cluster.js index 651b2f481d..d60366aaf1 100644 --- a/lib/cluster.js +++ b/lib/cluster.js @@ -684,10 +684,12 @@ function workerInit() { Worker.prototype.destroy = function() { this.exitedAfterDisconnect = true; - if (!this.isConnected()) process.exit(0); - var exit = process.exit.bind(null, 0); - send({ act: 'exitedAfterDisconnect' }, () => process.disconnect()); - process.once('disconnect', exit); + if (!this.isConnected()) { + process.exit(0); + } else { + send({ act: 'exitedAfterDisconnect' }, () => process.disconnect()); + process.once('disconnect', () => process.exit(0)); + } }; function send(message, cb) {