diff --git a/lib/internal/bootstrap/pre_execution.js b/lib/internal/bootstrap/pre_execution.js index 237fa183d5336d..52a6be6dee63c3 100644 --- a/lib/internal/bootstrap/pre_execution.js +++ b/lib/internal/bootstrap/pre_execution.js @@ -165,6 +165,23 @@ function initializeDeprecations() { const { deprecate } = require('internal/util'); const pendingDeprecation = getOptionValue('--pending-deprecation'); + // Handle `--debug*` deprecation and invalidation. + if (getOptionValue('--debug')) { + if (!getOptionValue('--inspect')) { + 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 (getOptionValue('--inspect-brk')) { + process._deprecatedDebugBrk = true; + process.emitWarning( + '`node --inspect --debug-brk` is deprecated. ' + + 'Please use `node --inspect-brk` instead.', + 'DeprecationWarning', 'DEP0062', undefined, true); + } + } + // DEP0103: access to `process.binding('util').isX` type checkers // TODO(addaleax): Turn into a full runtime deprecation. const utilBinding = internalBinding('util'); diff --git a/src/node_process_object.cc b/src/node_process_object.cc index e4d9d97c681bdd..e3b8eb8d54b7ba 100644 --- a/src/node_process_object.cc +++ b/src/node_process_object.cc @@ -256,18 +256,6 @@ MaybeLocal CreateProcessObject( "_breakNodeFirstLine", True(env->isolate())); } - // --inspect --debug-brk - if (env->options()->debug_options().deprecated_invocation()) { - READONLY_DONT_ENUM_PROPERTY(process, - "_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 { \