src: disable debug options when inspector is unavailable

This fixes `parallel/test-cli-node-print-help` when Node.js
is compiled without the inspector.

PR-URL: https://github.com/nodejs/node/pull/22657
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Denys Otrishko <shishugi@gmail.com>
This commit is contained in:
Anna Henningsen 2018-09-02 16:51:32 +02:00
parent 04060e35b1
commit c100d400bd
No known key found for this signature in database
GPG Key ID: 9C63F3A6CD2AD8F9
2 changed files with 8 additions and 4 deletions

View File

@ -23,6 +23,7 @@ namespace options_parser {
// TODO(addaleax): Make that unnecessary. // TODO(addaleax): Make that unnecessary.
DebugOptionsParser::DebugOptionsParser() { DebugOptionsParser::DebugOptionsParser() {
#if HAVE_INSPECTOR
AddOption("--inspect-port", AddOption("--inspect-port",
"set host:port for inspector", "set host:port for inspector",
&DebugOptions::host_port, &DebugOptions::host_port,
@ -52,6 +53,7 @@ DebugOptionsParser::DebugOptionsParser() {
AddOption("--debug-brk", "", &DebugOptions::break_first_line); AddOption("--debug-brk", "", &DebugOptions::break_first_line);
Implies("--debug-brk", "--debug"); Implies("--debug-brk", "--debug");
AddAlias("--debug-brk=", { "--inspect-port", "--debug-brk" }); AddAlias("--debug-brk=", { "--inspect-port", "--debug-brk" });
#endif
} }
DebugOptionsParser DebugOptionsParser::instance; DebugOptionsParser DebugOptionsParser::instance;

View File

@ -6,10 +6,12 @@ require('../common');
const assert = require('assert'); const assert = require('assert');
const spawn = require('child_process').spawnSync; const spawn = require('child_process').spawnSync;
requiresArgument('--inspect-port'); if (process.config.variables.v8_enable_inspector === 1) {
requiresArgument('--inspect-port='); requiresArgument('--inspect-port');
requiresArgument('--debug-port'); requiresArgument('--inspect-port=');
requiresArgument('--debug-port='); requiresArgument('--debug-port');
requiresArgument('--debug-port=');
}
requiresArgument('--eval'); requiresArgument('--eval');
function requiresArgument(option) { function requiresArgument(option) {