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: https://github.com/nodejs/node/pull/25828
Refs: https://github.com/nodejs/node/pull/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>
This commit is contained in:
Joyee Cheung 2019-01-31 03:14:59 +08:00
parent c369b3e929
commit 154efc9bde
No known key found for this signature in database
GPG Key ID: 92B78A53C8303B8D
4 changed files with 7 additions and 17 deletions

View File

@ -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.',

View File

@ -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) {

View File

@ -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;
}

View File

@ -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 { \