mirror of
https://github.com/nodejs/node.git
synced 2024-12-01 16:10:02 +01:00
eaaec57332
PR-URL: https://github.com/nodejs/node/pull/13702 Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Sam Roberts <vieuxtech@gmail.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
23 lines
570 B
JavaScript
23 lines
570 B
JavaScript
'use strict';
|
|
const common = require('../common');
|
|
const assert = require('assert');
|
|
const cluster = require('cluster');
|
|
|
|
if (cluster.isMaster) {
|
|
function forkWorker(action) {
|
|
const worker = cluster.fork({ action });
|
|
worker.on('disconnect', common.mustCall(() => {
|
|
assert.strictEqual(worker.exitedAfterDisconnect, true);
|
|
}));
|
|
|
|
worker.on('exit', common.mustCall(() => {
|
|
assert.strictEqual(worker.exitedAfterDisconnect, true);
|
|
}));
|
|
}
|
|
|
|
forkWorker('disconnect');
|
|
forkWorker('kill');
|
|
} else {
|
|
cluster.worker[process.env.action]();
|
|
}
|