blob: 05c7ec24b90d30afeefc9da955d044cc388e5e2c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
'use strict';
const common = require('../common');
const cluster = require('cluster');
const assert = require('assert');
common.skipIfInspectorDisabled();
checkForInspectSupport('--inspect');
function checkForInspectSupport(flag) {
const nodeOptions = JSON.stringify(flag);
const numWorkers = 2;
process.env.NODE_OPTIONS = flag;
if (cluster.isMaster) {
for (let i = 0; i < numWorkers; i++) {
cluster.fork();
}
cluster.on('online', (worker) => {
worker.disconnect();
});
cluster.on('exit', common.mustCall((worker, code, signal) => {
const errMsg = `For NODE_OPTIONS ${nodeOptions}, failed to start cluster`;
assert.strictEqual(worker.exitedAfterDisconnect, true, errMsg);
}, numWorkers));
}
}
|