Skip to content

Commit 0d4ccfe

Browse files
joyeecheungtargos
authored andcommitted
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 nodejs#25828. PR-URL: nodejs#26670 Refs: nodejs#25828
1 parent 9fac2c3 commit 0d4ccfe

File tree

2 files changed

+17
-12
lines changed

2 files changed

+17
-12
lines changed

lib/internal/bootstrap/pre_execution.js

+17
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,23 @@ function initializeDeprecations() {
165165
const { deprecate } = require('internal/util');
166166
const pendingDeprecation = getOptionValue('--pending-deprecation');
167167

168+
// Handle `--debug*` deprecation and invalidation.
169+
if (getOptionValue('--debug')) {
170+
if (!getOptionValue('--inspect')) {
171+
process.emitWarning(
172+
'`node --debug` and `node --debug-brk` are invalid. ' +
173+
'Please use `node --inspect` or `node --inspect-brk` instead.',
174+
'DeprecationWarning', 'DEP0062', undefined, true);
175+
process.exit(9);
176+
} else if (getOptionValue('--inspect-brk')) {
177+
process._deprecatedDebugBrk = true;
178+
process.emitWarning(
179+
'`node --inspect --debug-brk` is deprecated. ' +
180+
'Please use `node --inspect-brk` instead.',
181+
'DeprecationWarning', 'DEP0062', undefined, true);
182+
}
183+
}
184+
168185
// DEP0103: access to `process.binding('util').isX` type checkers
169186
// TODO(addaleax): Turn into a full runtime deprecation.
170187
const utilBinding = internalBinding('util');

src/node_process_object.cc

-12
Original file line numberDiff line numberDiff line change
@@ -256,18 +256,6 @@ MaybeLocal<Object> CreateProcessObject(
256256
"_breakNodeFirstLine", True(env->isolate()));
257257
}
258258

259-
// --inspect --debug-brk
260-
if (env->options()->debug_options().deprecated_invocation()) {
261-
READONLY_DONT_ENUM_PROPERTY(process,
262-
"_deprecatedDebugBrk", True(env->isolate()));
263-
}
264-
265-
// --debug or, --debug-brk without --inspect
266-
if (env->options()->debug_options().invalid_invocation()) {
267-
READONLY_DONT_ENUM_PROPERTY(process,
268-
"_invalidDebug", True(env->isolate()));
269-
}
270-
271259
// --security-revert flags
272260
#define V(code, _, __) \
273261
do { \

0 commit comments

Comments
 (0)