mirror of https://github.com/lukechilds/node.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
36 lines
956 B
36 lines
956 B
'use strict';
|
|
const common = require('../common');
|
|
|
|
// A test to ensure that cluster properly interoperates with the
|
|
// --inspect-brk option.
|
|
|
|
const assert = require('assert');
|
|
const cluster = require('cluster');
|
|
const debuggerPort = common.PORT;
|
|
|
|
if (cluster.isMaster) {
|
|
function test(execArgv) {
|
|
|
|
cluster.setupMaster({
|
|
execArgv: execArgv,
|
|
stdio: ['pipe', 'pipe', 'pipe', 'ipc', 'pipe']
|
|
});
|
|
|
|
const worker = cluster.fork();
|
|
|
|
// Debugger listening on port [port].
|
|
worker.process.stderr.once('data', common.mustCall(function() {
|
|
worker.process.kill('SIGTERM');
|
|
}));
|
|
|
|
worker.process.on('exit', common.mustCall(function(code, signal) {
|
|
assert.strictEqual(signal, 'SIGTERM');
|
|
}));
|
|
}
|
|
|
|
test(['--inspect-brk']);
|
|
test([`--inspect-brk=${debuggerPort}`]);
|
|
} else {
|
|
// Cluster worker is at a breakpoint, should not reach here.
|
|
assert.fail('Test failed: cluster worker should be at a breakpoint.');
|
|
}
|
|
|