Skip to content

Commit 85bf8d0

Browse files
committed
inspector: restore --debug-brk alias
--inspect-brk didn't exist prior to 7.6.0, and --debug-brk doesn't exist after #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: #12364
1 parent bde26a6 commit 85bf8d0

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

src/node_debug_options.cc

+6-6
Original file line numberDiff line numberDiff line change
@@ -94,18 +94,18 @@ bool DebugOptions::ParseOption(const std::string& option) {
9494
argument = option.substr(pos + 1);
9595
}
9696

97+
// Note that --debug-port and --debug-brk are undocumented, but to be
98+
// supported until 7.x is no longer supported, not even in LTS (see #12364).
9799
if (option_name == "--inspect") {
98100
debugger_enabled_ = true;
99101
enable_inspector = true;
100-
} else if (option_name == "--inspect-brk") {
102+
} else if (option_name == "--inspect-brk" || option_name == "--debug-brk") {
101103
debugger_enabled_ = true;
102104
enable_inspector = true;
103105
wait_connect_ = true;
104-
} else if ((option_name != "--debug-port" &&
105-
option_name != "--inspect-port") ||
106-
!has_argument) {
107-
// only other valid possibility is --inspect-port,
108-
// which requires an argument
106+
} else if (option_name == "--inspect-port" || option_name == "--debug-port") {
107+
if (!has_argument) return false;
108+
} else {
109109
return false;
110110
}
111111

src/node_debug_options.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ class DebugOptions {
4040
#if HAVE_INSPECTOR
4141
bool inspector_enabled_;
4242
#endif // HAVE_INSPECTOR
43-
bool wait_connect_;
43+
bool wait_connect_; // --inspect-brk
4444
bool http_enabled_;
4545
std::string host_name_;
4646
int port_;

0 commit comments

Comments
 (0)