Skip to content

Commit

Permalink
src: disable debug options when inspector is unavailable
Browse files Browse the repository at this point in the history
This fixes `parallel/test-cli-node-print-help` when Node.js
is compiled without the inspector.

PR-URL: #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>
  • Loading branch information
addaleax committed Sep 2, 2018
1 parent 04060e3 commit c100d40
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
2 changes: 2 additions & 0 deletions src/node_options.cc
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ namespace options_parser {
// TODO(addaleax): Make that unnecessary.

DebugOptionsParser::DebugOptionsParser() {
#if HAVE_INSPECTOR
AddOption("--inspect-port",
"set host:port for inspector",
&DebugOptions::host_port,
Expand Down Expand Up @@ -52,6 +53,7 @@ DebugOptionsParser::DebugOptionsParser() {
AddOption("--debug-brk", "", &DebugOptions::break_first_line);
Implies("--debug-brk", "--debug");
AddAlias("--debug-brk=", { "--inspect-port", "--debug-brk" });
#endif
}

DebugOptionsParser DebugOptionsParser::instance;
Expand Down
10 changes: 6 additions & 4 deletions test/parallel/test-cli-bad-options.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,12 @@ require('../common');
const assert = require('assert');
const spawn = require('child_process').spawnSync;

requiresArgument('--inspect-port');
requiresArgument('--inspect-port=');
requiresArgument('--debug-port');
requiresArgument('--debug-port=');
if (process.config.variables.v8_enable_inspector === 1) {
requiresArgument('--inspect-port');
requiresArgument('--inspect-port=');
requiresArgument('--debug-port');
requiresArgument('--debug-port=');
}
requiresArgument('--eval');

function requiresArgument(option) {
Expand Down

0 comments on commit c100d40

Please sign in to comment.