Skip to content
Permalink
Browse files

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 <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 Jan 30, 2019
1 parent c369b3e commit 154efc9bdef3ba8df5d3dfe3b32102baf3ac4311
Showing with 7 additions and 17 deletions.
  1. +1 −7 lib/internal/bootstrap/node.js
  2. +6 −0 src/node_options.cc
  3. +0 −4 src/node_options.h
  4. +0 −6 src/node_process_object.cc
@@ -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.',
@@ -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) {
@@ -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;
}
@@ -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 { \

0 comments on commit 154efc9

Please sign in to comment.
You can’t perform that action at this time.