From be3ea2a1eb315ff086d11f0e6d7006b6e55d296c Mon Sep 17 00:00:00 2001 From: Joyee Cheung Date: Thu, 14 Mar 2019 00:58:16 +0800 Subject: [PATCH] process: handle node --debug deprecation in pre-execution In addition, shim `process._deprecatedDebugBrk` in pre-execution. This is a non-semver-major v11.x backport for https://github.com/nodejs/node/pull/25828. PR-URL: https://github.com/nodejs/node/pull/26670 Refs: https://github.com/nodejs/node/pull/25828 --- lib/internal/bootstrap/pre_execution.js | 17 +++++++++++++++++ src/node_process_object.cc | 12 ------------ 2 files changed, 17 insertions(+), 12 deletions(-) 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 { \