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
#25828.

PR-URL: #26670
Refs: #25828
  • Loading branch information
joyeecheung authored and targos committed Mar 27, 2019
1 parent 249bf50 commit be3ea2a
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 12 deletions.
17 changes: 17 additions & 0 deletions lib/internal/bootstrap/pre_execution.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
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 be3ea2a

Please sign in to comment.