diff options
author | yorkie <yorkiefixer@gmail.com> | 2016-05-01 22:55:05 +0800 |
---|---|---|
committer | cjihrig <cjihrig@gmail.com> | 2016-05-03 09:31:51 -0400 |
commit | 4e905fa8d5be1ff90895964a7f86401bc2b86462 (patch) | |
tree | 7f7688fb1e72433b1f8c312d2eb1a17e2525b22e /lib/cluster.js | |
parent | db3db078f3177f10cdce655bf61943938a7bb123 (diff) | |
download | android-node-v8-4e905fa8d5be1ff90895964a7f86401bc2b86462.tar.gz android-node-v8-4e905fa8d5be1ff90895964a7f86401bc2b86462.tar.bz2 android-node-v8-4e905fa8d5be1ff90895964a7f86401bc2b86462.zip |
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 <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'lib/cluster.js')
-rw-r--r-- | lib/cluster.js | 10 |
1 files 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) { |