Skip to content

Commit 190a830

Browse files
committed
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. Refs: nodejs#25828
1 parent 1fa5004 commit 190a830

File tree

3 files changed

+17
-26
lines changed

3 files changed

+17
-26
lines changed

lib/internal/bootstrap/node.js

-14
Original file line numberDiff line numberDiff line change
@@ -222,20 +222,6 @@ Object.defineProperty(process, 'argv0', {
222222
});
223223
process.argv[0] = process.execPath;
224224

225-
// Handle `--debug*` deprecation and invalidation.
226-
if (process._invalidDebug) {
227-
process.emitWarning(
228-
'`node --debug` and `node --debug-brk` are invalid. ' +
229-
'Please use `node --inspect` or `node --inspect-brk` instead.',
230-
'DeprecationWarning', 'DEP0062', undefined, true);
231-
process.exit(9);
232-
} else if (process._deprecatedDebugBrk) {
233-
process.emitWarning(
234-
'`node --inspect --debug-brk` is deprecated. ' +
235-
'Please use `node --inspect-brk` instead.',
236-
'DeprecationWarning', 'DEP0062', undefined, true);
237-
}
238-
239225
// TODO(jasnell): The following have been globals since around 2012.
240226
// That's just silly. The underlying perfctr support has been removed
241227
// so these are now deprecated non-ops that can be removed after one

lib/internal/bootstrap/pre_execution.js

+17
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,23 @@ function initializeDeprecations() {
106106
const { deprecate } = require('internal/util');
107107
const pendingDeprecation = getOptionValue('--pending-deprecation');
108108

109+
// Handle `--debug*` deprecation and invalidation.
110+
if (getOptionValue('--debug')) {
111+
if (!getOptionValue('--inspect')) {
112+
process.emitWarning(
113+
'`node --debug` and `node --debug-brk` are invalid. ' +
114+
'Please use `node --inspect` or `node --inspect-brk` instead.',
115+
'DeprecationWarning', 'DEP0062', undefined, true);
116+
process.exit(9);
117+
} else if (getOptionValue('--inspect-brk')) {
118+
process._deprecatedDebugBrk = true;
119+
process.emitWarning(
120+
'`node --inspect --debug-brk` is deprecated. ' +
121+
'Please use `node --inspect-brk` instead.',
122+
'DeprecationWarning', 'DEP0062', undefined, true);
123+
}
124+
}
125+
109126
// DEP0103: access to `process.binding('util').isX` type checkers
110127
// TODO(addaleax): Turn into a full runtime deprecation.
111128
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)