mirror of
https://github.com/nodejs/node.git
synced 2025-05-13 10:54:13 +00:00

A new version of ESLint flags chained properties on multiple lines that were not flagged by the previous version of ESLint. In preparation for turning that feature on, adjust alignment to that expected by the linter. This change happened to be predominantly around assertions using `assert()` and `assert.equal()`. These were changed to `assert.strictEqual()` where possible. PR-URL: https://github.com/nodejs/node/pull/7920 Reviewed-By: Michaël Zasso <mic.besace@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
45 lines
1.1 KiB
JavaScript
45 lines
1.1 KiB
JavaScript
'use strict';
|
|
const common = require('../common');
|
|
var assert = require('assert');
|
|
var cluster = require('cluster');
|
|
|
|
var SENTINEL = 42;
|
|
|
|
// workers forcibly exit when control channel is disconnected, if
|
|
// their .exitedAfterDisconnect flag isn't set
|
|
//
|
|
// test this by:
|
|
//
|
|
// 1 setup worker to wait a short time after disconnect, and exit
|
|
// with a sentinel value
|
|
// 2 disconnect worker with cluster's disconnect, confirm sentinel
|
|
// 3 disconnect worker with child_process's disconnect, confirm
|
|
// no sentinel value
|
|
if (cluster.isWorker) {
|
|
process.on('disconnect', function(msg) {
|
|
setTimeout(function() {
|
|
process.exit(SENTINEL);
|
|
}, 10);
|
|
});
|
|
return;
|
|
}
|
|
|
|
checkUnforced();
|
|
checkForced();
|
|
|
|
function checkUnforced() {
|
|
cluster.fork()
|
|
.on('online', function() { this.disconnect(); })
|
|
.on('exit', common.mustCall(function(status) {
|
|
assert.strictEqual(status, SENTINEL);
|
|
}));
|
|
}
|
|
|
|
function checkForced() {
|
|
cluster.fork()
|
|
.on('online', function() { this.process.disconnect(); })
|
|
.on('exit', common.mustCall(function(status) {
|
|
assert.strictEqual(status, 0);
|
|
}));
|
|
}
|