mirror of
https://github.com/nodejs/node.git
synced 2025-05-06 05:21:19 +00:00

`--debug=1.2.3.4:5678` and `--debug=example.com:5678` are now accepted, likewise the `--debug-brk` and `--debug-port` switch. The latter is now something of a misnomer but it's undocumented and for internal use only so it shouldn't matter too much. `--inspect=1.2.3.4:5678` and `--inspect=example.com:5678` are also accepted but don't use the host name yet; they still bind to the default address. Fixes: https://github.com/nodejs/node/issues/3306 PR-URL: https://github.com/nodejs/node/pull/3316 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Trevor Norris <trev.norris@gmail.com>
33 lines
867 B
JavaScript
33 lines
867 B
JavaScript
'use strict';
|
|
const common = require('../common');
|
|
const assert = require('assert');
|
|
const spawn = require('child_process').spawn;
|
|
|
|
const PORT_MIN = common.PORT + 1; // The fixture uses common.PORT.
|
|
const PORT_MAX = PORT_MIN + 2;
|
|
|
|
const args = [
|
|
'--debug=' + PORT_MIN,
|
|
common.fixturesDir + '/clustered-server/app.js'
|
|
];
|
|
|
|
const child = spawn(process.execPath, args);
|
|
child.stderr.setEncoding('utf8');
|
|
|
|
const checkMessages = common.mustCall(() => {
|
|
for (let port = PORT_MIN; port <= PORT_MAX; port += 1) {
|
|
const re = RegExp(`Debugger listening on (\\[::\\]|0\\.0\\.0\\.0):${port}`);
|
|
assert(re.test(stderr));
|
|
}
|
|
});
|
|
|
|
let stderr = '';
|
|
child.stderr.on('data', (data) => {
|
|
process.stderr.write(`[DATA] ${data}`);
|
|
stderr += data;
|
|
if (child.killed !== true && stderr.includes('all workers are running')) {
|
|
child.kill();
|
|
checkMessages();
|
|
}
|
|
});
|