Skip to content

Commit

Permalink
process: exit on --debug and --debug-brk after option parsing
Browse files Browse the repository at this point in the history
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 <anna@addaleax.net>
Reviewed-By: Eugene Ostroukhov <eostroukhov@google.com>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
  • Loading branch information
joyeecheung committed Feb 1, 2019
1 parent c369b3e commit 154efc9
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 17 deletions.
8 changes: 1 addition & 7 deletions lib/internal/bootstrap/node.js
Original file line number Diff line number Diff line change
Expand Up @@ -204,13 +204,7 @@ Object.defineProperty(process, 'argv0', {
process.argv[0] = process.execPath;

// Handle `--debug*` deprecation and invalidation.
if (process._invalidDebug) {
process.emitWarning(
'`node --debug` and `node --debug-brk` are invalid. ' +
'Please use `node --inspect` or `node --inspect-brk` instead.',
'DeprecationWarning', 'DEP0062', undefined, true);
process.exit(9);
} else if (process._deprecatedDebugBrk) {
if (process._deprecatedDebugBrk) {
process.emitWarning(
'`node --inspect --debug-brk` is deprecated. ' +
'Please use `node --inspect-brk` instead.',
Expand Down
6 changes: 6 additions & 0 deletions src/node_options.cc
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,12 @@ void DebugOptions::CheckOptions(std::vector<std::string>* errors) {
"--without-v8-platform");
}
#endif

if (deprecated_debug && !inspector_enabled) {
errors->push_back("[DEP0062]: `node --debug` and `node --debug-brk` "
"are invalid. Please use `node --inspect` or "
"`node --inspect-brk` instead.");
}
}

void PerProcessOptions::CheckOptions(std::vector<std::string>* errors) {
Expand Down
4 changes: 0 additions & 4 deletions src/node_options.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,6 @@ class DebugOptions : public Options {
break_first_line;
}

bool invalid_invocation() const {
return deprecated_debug && !inspector_enabled;
}

bool wait_for_connect() const {
return break_first_line || break_node_first_line;
}
Expand Down
6 changes: 0 additions & 6 deletions src/node_process_object.cc
Original file line number Diff line number Diff line change
Expand Up @@ -265,12 +265,6 @@ MaybeLocal<Object> CreateProcessObject(
"_deprecatedDebugBrk", True(env->isolate()));
}

// --debug or, --debug-brk without --inspect
if (env->options()->debug_options().invalid_invocation()) {
READONLY_DONT_ENUM_PROPERTY(process,
"_invalidDebug", True(env->isolate()));
}

// --security-revert flags
#define V(code, _, __) \
do { \
Expand Down

0 comments on commit 154efc9

Please sign in to comment.