Skip to content

Commit 154efc9

Browse files
committed
process: exit on --debug and --debug-brk after option parsing
Moves the exit of `--debug` and `--debug-brk` earlier, that is, after the option parsing is done in the C++ land. Also removes `process._invalidDebug`. PR-URL: #25828 Refs: #12949 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Eugene Ostroukhov <[email protected]> Reviewed-By: Richard Lau <[email protected]> Reviewed-By: Matteo Collina <[email protected]>
1 parent c369b3e commit 154efc9

File tree

4 files changed

+7
-17
lines changed

4 files changed

+7
-17
lines changed

lib/internal/bootstrap/node.js

+1-7
Original file line numberDiff line numberDiff line change
@@ -204,13 +204,7 @@ Object.defineProperty(process, 'argv0', {
204204
process.argv[0] = process.execPath;
205205

206206
// Handle `--debug*` deprecation and invalidation.
207-
if (process._invalidDebug) {
208-
process.emitWarning(
209-
'`node --debug` and `node --debug-brk` are invalid. ' +
210-
'Please use `node --inspect` or `node --inspect-brk` instead.',
211-
'DeprecationWarning', 'DEP0062', undefined, true);
212-
process.exit(9);
213-
} else if (process._deprecatedDebugBrk) {
207+
if (process._deprecatedDebugBrk) {
214208
process.emitWarning(
215209
'`node --inspect --debug-brk` is deprecated. ' +
216210
'Please use `node --inspect-brk` instead.',

src/node_options.cc

+6
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,12 @@ void DebugOptions::CheckOptions(std::vector<std::string>* errors) {
3030
"--without-v8-platform");
3131
}
3232
#endif
33+
34+
if (deprecated_debug && !inspector_enabled) {
35+
errors->push_back("[DEP0062]: `node --debug` and `node --debug-brk` "
36+
"are invalid. Please use `node --inspect` or "
37+
"`node --inspect-brk` instead.");
38+
}
3339
}
3440

3541
void PerProcessOptions::CheckOptions(std::vector<std::string>* errors) {

src/node_options.h

-4
Original file line numberDiff line numberDiff line change
@@ -81,10 +81,6 @@ class DebugOptions : public Options {
8181
break_first_line;
8282
}
8383

84-
bool invalid_invocation() const {
85-
return deprecated_debug && !inspector_enabled;
86-
}
87-
8884
bool wait_for_connect() const {
8985
return break_first_line || break_node_first_line;
9086
}

src/node_process_object.cc

-6
Original file line numberDiff line numberDiff line change
@@ -265,12 +265,6 @@ MaybeLocal<Object> CreateProcessObject(
265265
"_deprecatedDebugBrk", True(env->isolate()));
266266
}
267267

268-
// --debug or, --debug-brk without --inspect
269-
if (env->options()->debug_options().invalid_invocation()) {
270-
READONLY_DONT_ENUM_PROPERTY(process,
271-
"_invalidDebug", True(env->isolate()));
272-
}
273-
274268
// --security-revert flags
275269
#define V(code, _, __) \
276270
do { \

0 commit comments

Comments
 (0)