src: remove process.binding('config').debugOptions
`process.binding('config').debugOptions`, which contains the initial values of parsed debugger-related CLI options, has been used for internal testing. This patch removes them and uses `internal/options` to query the values in the tests instead. PR-URL: https://github.com/nodejs/node/pull/25999 Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: James M Snell <jasnell@gmail.com>
This commit is contained in:
parent
a99316065d
commit
b200a46bef
@ -6,9 +6,7 @@
|
|||||||
|
|
||||||
namespace node {
|
namespace node {
|
||||||
|
|
||||||
using v8::Boolean;
|
|
||||||
using v8::Context;
|
using v8::Context;
|
||||||
using v8::Integer;
|
|
||||||
using v8::Isolate;
|
using v8::Isolate;
|
||||||
using v8::Local;
|
using v8::Local;
|
||||||
using v8::Number;
|
using v8::Number;
|
||||||
@ -72,19 +70,6 @@ static void Initialize(Local<Object> target,
|
|||||||
READONLY_PROPERTY(target,
|
READONLY_PROPERTY(target,
|
||||||
"bits",
|
"bits",
|
||||||
Number::New(env->isolate(), 8 * sizeof(intptr_t)));
|
Number::New(env->isolate(), 8 * sizeof(intptr_t)));
|
||||||
|
|
||||||
Local<Object> debug_options_obj = Object::New(isolate);
|
|
||||||
READONLY_PROPERTY(target, "debugOptions", debug_options_obj);
|
|
||||||
|
|
||||||
const DebugOptions& debug_options = env->options()->debug_options();
|
|
||||||
READONLY_PROPERTY(debug_options_obj,
|
|
||||||
"inspectorEnabled",
|
|
||||||
Boolean::New(isolate, debug_options.inspector_enabled));
|
|
||||||
READONLY_STRING_PROPERTY(
|
|
||||||
debug_options_obj, "host", debug_options.host_port.host());
|
|
||||||
READONLY_PROPERTY(debug_options_obj,
|
|
||||||
"port",
|
|
||||||
Integer::New(isolate, debug_options.host_port.port()));
|
|
||||||
} // InitConfig
|
} // InitConfig
|
||||||
|
|
||||||
} // namespace node
|
} // namespace node
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
|
// Flags: --expose-internals
|
||||||
|
|
||||||
const common = require('../common');
|
const common = require('../common');
|
||||||
|
|
||||||
common.skipIfInspectorDisabled();
|
common.skipIfInspectorDisabled();
|
||||||
@ -205,7 +207,7 @@ function testRunnerMain() {
|
|||||||
}
|
}
|
||||||
function masterProcessMain() {
|
function masterProcessMain() {
|
||||||
const workers = JSON.parse(process.env.workers);
|
const workers = JSON.parse(process.env.workers);
|
||||||
const clusterSettings = JSON.parse(process.env.clusterSettings);
|
const clusterSettings = JSON.parse(process.env.clusterSettings) || {};
|
||||||
const badPortError = { type: RangeError, code: 'ERR_SOCKET_BAD_PORT' };
|
const badPortError = { type: RangeError, code: 'ERR_SOCKET_BAD_PORT' };
|
||||||
let debugPort = process.debugPort;
|
let debugPort = process.debugPort;
|
||||||
|
|
||||||
@ -224,7 +226,10 @@ function masterProcessMain() {
|
|||||||
params.expectedHost = worker.expectedHost;
|
params.expectedHost = worker.expectedHost;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (clusterSettings) {
|
clusterSettings.execArgv = clusterSettings.execArgv ?
|
||||||
|
clusterSettings.execArgv.concat(['--expose-internals']) :
|
||||||
|
process.execArgv.concat(['--expose-internals']);
|
||||||
|
|
||||||
if (clusterSettings.inspectPort === 'addTwo') {
|
if (clusterSettings.inspectPort === 'addTwo') {
|
||||||
clusterSettings.inspectPort = common.mustCall(
|
clusterSettings.inspectPort = common.mustCall(
|
||||||
() => { return debugPort += 2; },
|
() => { return debugPort += 2; },
|
||||||
@ -293,8 +298,8 @@ function masterProcessMain() {
|
|||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
cluster.setupMaster(clusterSettings);
|
cluster.setupMaster(clusterSettings);
|
||||||
}
|
|
||||||
|
|
||||||
cluster.fork(params).on('exit', common.mustCall(checkExitCode));
|
cluster.fork(params).on('exit', common.mustCall(checkExitCode));
|
||||||
}
|
}
|
||||||
@ -302,7 +307,8 @@ function masterProcessMain() {
|
|||||||
|
|
||||||
function workerProcessMain() {
|
function workerProcessMain() {
|
||||||
const { expectedPort, expectedInitialPort, expectedHost } = process.env;
|
const { expectedPort, expectedInitialPort, expectedHost } = process.env;
|
||||||
const debugOptions = process.binding('config').debugOptions;
|
const debugOptions =
|
||||||
|
require('internal/options').getOptionValue('--inspect-port');
|
||||||
|
|
||||||
if ('expectedPort' in process.env) {
|
if ('expectedPort' in process.env) {
|
||||||
assert.strictEqual(process.debugPort, +expectedPort);
|
assert.strictEqual(process.debugPort, +expectedPort);
|
||||||
@ -327,7 +333,7 @@ function spawnMaster({ execArgv, workers, clusterSettings = {} }) {
|
|||||||
clusterSettings: JSON.stringify(clusterSettings),
|
clusterSettings: JSON.stringify(clusterSettings),
|
||||||
testProcess: true
|
testProcess: true
|
||||||
}),
|
}),
|
||||||
execArgv
|
execArgv: execArgv.concat(['--expose-internals'])
|
||||||
}).on('exit', common.mustCall((code, signal) => {
|
}).on('exit', common.mustCall((code, signal) => {
|
||||||
checkExitCode(code, signal);
|
checkExitCode(code, signal);
|
||||||
resolve();
|
resolve();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user