Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

src: disable debug options when inspector is unavailable #22657

Closed
Closed
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
12 changes: 7 additions & 5 deletions test/parallel/test-cli-bad-options.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
'use strict';
require('../common');
const common = require('../common');

// Tests that node exits consistently on bad option syntax.

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