From 5eeb4f5708f7c20d81ebbb6bb4d97749edd3135b Mon Sep 17 00:00:00 2001 From: Sam Roberts Date: Fri, 21 Apr 2017 20:28:01 -0700 Subject: [PATCH] inspector: restore --debug-brk alias --inspect-brk didn't exist prior to 7.6.0, and --debug-brk doesn't exist after https://github.com/nodejs/node/pull/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: https://github.com/nodejs/node/issues/12364 --- src/node_debug_options.cc | 13 +++++++------ src/node_debug_options.h | 2 +- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/node_debug_options.cc b/src/node_debug_options.cc index 5033beb8d79ce1..2e4012978ec301 100644 --- a/src/node_debug_options.cc +++ b/src/node_debug_options.cc @@ -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; } diff --git a/src/node_debug_options.h b/src/node_debug_options.h index ae54bf9d23d93a..4795d3e0cce012 100644 --- a/src/node_debug_options.h +++ b/src/node_debug_options.h @@ -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_;