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>
This commit is contained in:
yorkie authored and Jeremiah Senkpiel committed 2016-05-03 20:20:41 -04:00
1 parent 08e0884ae0
commit 1330496bbf
1 file changed
+6 -4
+6 -4
View File
@@ -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) {