Skip to content

Commit

Permalink
inspector: restore --debug-brk alias
Browse files Browse the repository at this point in the history
--inspect-brk didn't exist prior to 7.6.0, and --debug-brk doesn't exist
after nodejs#12197, leaving no consistent
way to start node with inspector activated and breaking on first line.
Add --debug-brk back in as an undocumented option until 7.x is no longer
supported.

Fixes: nodejs#12364
  • Loading branch information
sam-github authored and Jan Krems committed May 4, 2017
1 parent d0c968e commit 5eeb4f5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
13 changes: 7 additions & 6 deletions src/node_debug_options.cc
Original file line number Diff line number Diff line change
Expand Up @@ -77,16 +77,17 @@ bool DebugOptions::ParseOption(const std::string& option) {
argument = option.substr(pos + 1);
}

// Note that --debug-port and --debug-brk are undocumented, but to be
// supported until 7.x is no longer supported, not even in LTS (see #12364).
if (option_name == "--inspect") {
enable_inspector = true;
} else if (option_name == "--inspect-brk") {
} else if (option_name == "--inspect-brk" || option_name == "--debug-brk") {
debugger_enabled_ = true;
enable_inspector = true;
wait_connect_ = true;
} else if ((option_name != "--debug-port" &&
option_name != "--inspect-port") ||
!has_argument) {
// only other valid possibility is --inspect-port,
// which requires an argument
} else if (option_name == "--inspect-port" || option_name == "--debug-port") {
if (!has_argument) return false;
} else {
return false;
}

Expand Down
2 changes: 1 addition & 1 deletion src/node_debug_options.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class DebugOptions {
#if HAVE_INSPECTOR
bool inspector_enabled_;
#endif // HAVE_INSPECTOR
bool wait_connect_;
bool wait_connect_; // --inspect-brk
bool http_enabled_;
std::string host_name_;
int port_;
Expand Down

0 comments on commit 5eeb4f5

Please sign in to comment.