From c100d400bde53017931a7c93308e3293d50e21db Mon Sep 17 00:00:00 2001 From: Anna Henningsen Date: Sun, 2 Sep 2018 16:51:32 +0200 Subject: [PATCH] src: disable debug options when inspector is unavailable MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Reviewed-By: Michaƫl Zasso Reviewed-By: Rich Trott Reviewed-By: Refael Ackermann Reviewed-By: Denys Otrishko --- src/node_options.cc | 2 ++ test/parallel/test-cli-bad-options.js | 10 ++++++---- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/node_options.cc b/src/node_options.cc index 27e518d0f1f2d8..c8586ec64e3bb1 100644 --- a/src/node_options.cc +++ b/src/node_options.cc @@ -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, @@ -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; diff --git a/test/parallel/test-cli-bad-options.js b/test/parallel/test-cli-bad-options.js index ebc434670ed4a7..7abd330aa4726d 100644 --- a/test/parallel/test-cli-bad-options.js +++ b/test/parallel/test-cli-bad-options.js @@ -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) {