From 154efc9bdef3ba8df5d3dfe3b32102baf3ac4311 Mon Sep 17 00:00:00 2001 From: Joyee Cheung Date: Thu, 31 Jan 2019 03:14:59 +0800 Subject: [PATCH] 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 Reviewed-By: Eugene Ostroukhov Reviewed-By: Richard Lau Reviewed-By: Matteo Collina --- lib/internal/bootstrap/node.js | 8 +------- src/node_options.cc | 6 ++++++ src/node_options.h | 4 ---- src/node_process_object.cc | 6 ------ 4 files changed, 7 insertions(+), 17 deletions(-) diff --git a/lib/internal/bootstrap/node.js b/lib/internal/bootstrap/node.js index c2403bd9ff9604..c16e1a02d520c4 100644 --- a/lib/internal/bootstrap/node.js +++ b/lib/internal/bootstrap/node.js @@ -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.', diff --git a/src/node_options.cc b/src/node_options.cc index b7b924501a24ff..c1e75ff8106da8 100644 --- a/src/node_options.cc +++ b/src/node_options.cc @@ -30,6 +30,12 @@ void DebugOptions::CheckOptions(std::vector* 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* errors) { diff --git a/src/node_options.h b/src/node_options.h index 50c66ce890bf4c..d4e373d05d9280 100644 --- a/src/node_options.h +++ b/src/node_options.h @@ -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; } diff --git a/src/node_process_object.cc b/src/node_process_object.cc index c1f8806110ffef..89abe19a84ff57 100644 --- a/src/node_process_object.cc +++ b/src/node_process_object.cc @@ -265,12 +265,6 @@ MaybeLocal 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 { \