Skip to content

Commit

Permalink
process: handle node --debug deprecation in pre-execution
Browse files Browse the repository at this point in the history
In addition, shim `process._deprecatedDebugBrk` in pre-execution.
This is a non-semver-major v11.x backport for
nodejs#25828.

Refs: nodejs#25828
  • Loading branch information
joyeecheung committed Mar 15, 2019
1 parent 1fa5004 commit 190a830
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 26 deletions.
14 changes: 0 additions & 14 deletions lib/internal/bootstrap/node.js
Original file line number Diff line number Diff line change
Expand Up @@ -222,20 +222,6 @@ 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) {
process.emitWarning(
'`node --inspect --debug-brk` is deprecated. ' +
'Please use `node --inspect-brk` instead.',
'DeprecationWarning', 'DEP0062', undefined, true);
}

// TODO(jasnell): The following have been globals since around 2012.
// That's just silly. The underlying perfctr support has been removed
// so these are now deprecated non-ops that can be removed after one
Expand Down
17 changes: 17 additions & 0 deletions lib/internal/bootstrap/pre_execution.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,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');
Expand Down
12 changes: 0 additions & 12 deletions src/node_process_object.cc
Original file line number Diff line number Diff line change
Expand Up @@ -256,18 +256,6 @@ MaybeLocal<Object> 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 { \
Expand Down

0 comments on commit 190a830

Please sign in to comment.