mirror of
https://github.com/nodejs/node.git
synced 2025-05-07 23:17:19 +00:00

Manually fix issues that eslint --fix couldn't do automatically. PR-URL: https://github.com/nodejs/node/pull/10685 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Roman Reiss <me@silverwind.io>
29 lines
749 B
JavaScript
29 lines
749 B
JavaScript
'use strict';
|
|
require('../common');
|
|
const cluster = require('cluster');
|
|
const assert = require('assert');
|
|
|
|
if (cluster.isMaster) {
|
|
const worker = cluster.fork();
|
|
assert.ok(!worker.isDead(),
|
|
'isDead() should return false right after the worker has been ' +
|
|
'created.');
|
|
|
|
worker.on('exit', function() {
|
|
assert.ok(worker.isDead(),
|
|
'After an event has been emitted, ' +
|
|
'isDead should return true');
|
|
});
|
|
|
|
worker.on('message', function(msg) {
|
|
if (msg === 'readyToDie') {
|
|
worker.kill();
|
|
}
|
|
});
|
|
|
|
} else if (cluster.isWorker) {
|
|
assert.ok(!cluster.worker.isDead(),
|
|
'isDead() should return false when called from within a worker');
|
|
process.send('readyToDie');
|
|
}
|