Skip to content

Commit

Permalink
process: move DEP0062 (node --debug) to end-of-life
Browse files Browse the repository at this point in the history
This has already been practically end-of-life since `node --debug`
alone would exit the process. This patch drops support of
`node --inspect --debug-brk` as well.

`node --inspect --debug-brk` has been deprecated since v8,
it has been maintained so that vendors can target Node.js
v6 and above without detecting versions.
The support of `--inspect`, which starts from v6, will reach
end-of-life in April 2019, it should be safe to drop the support
of `--inspect --debug-brk` altogether in v12.

Also removes `process._deprecatedDebugBrk`

PR-URL: #25828
Refs: #12949
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Eugene Ostroukhov <eostroukhov@google.com>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
  • Loading branch information
joyeecheung committed Feb 1, 2019
1 parent 154efc9 commit fa5e097
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 41 deletions.
5 changes: 4 additions & 1 deletion doc/api/deprecations.md
Original file line number Diff line number Diff line change
Expand Up @@ -1279,9 +1279,12 @@ changes:
- version: v8.0.0
pr-url: https://github.com/nodejs/node/pull/10970
description: Runtime deprecation.
- version: REPLACEME
pr-url: https://github.com/nodejs/node/pull/25828
description: End-of-Life.
-->

Type: Runtime
Type: End-Of-Life

`--debug` activates the legacy V8 debugger interface, which was removed as
of V8 5.8. It is replaced by Inspector which is activated with `--inspect`
Expand Down
8 changes: 0 additions & 8 deletions lib/internal/bootstrap/node.js
Original file line number Diff line number Diff line change
Expand Up @@ -203,14 +203,6 @@ Object.defineProperty(process, 'argv0', {
});
process.argv[0] = process.execPath;

// Handle `--debug*` deprecation and invalidation.
if (process._deprecatedDebugBrk) {
process.emitWarning(
'`node --inspect --debug-brk` is deprecated. ' +
'Please use `node --inspect-brk` instead.',
'DeprecationWarning', 'DEP0062', undefined, true);
}

const { deprecate } = NativeModule.require('internal/util');
{
// Install legacy getters on the `util` binding for typechecking.
Expand Down
5 changes: 5 additions & 0 deletions src/node_options.cc
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,11 @@ void DebugOptions::CheckOptions(std::vector<std::string>* errors) {
"are invalid. Please use `node --inspect` or "
"`node --inspect-brk` instead.");
}

if (deprecated_debug && inspector_enabled && break_first_line) {
errors->push_back("[DEP0062]: `node --inspect --debug-brk` is deprecated. "
"Please use `node --inspect-brk` instead.");
}
}

void PerProcessOptions::CheckOptions(std::vector<std::string>* errors) {
Expand Down
6 changes: 0 additions & 6 deletions src/node_options.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,12 +75,6 @@ class DebugOptions : public Options {

HostPort host_port{"127.0.0.1", kDefaultInspectorPort};

bool deprecated_invocation() const {
return deprecated_debug &&
inspector_enabled &&
break_first_line;
}

bool wait_for_connect() const {
return break_first_line || break_node_first_line;
}
Expand Down
6 changes: 0 additions & 6 deletions src/node_process_object.cc
Original file line number Diff line number Diff line change
Expand Up @@ -259,12 +259,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()));
}

// --security-revert flags
#define V(code, _, __) \
do { \
Expand Down
27 changes: 7 additions & 20 deletions test/sequential/test-debugger-debug-brk.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,32 +2,19 @@
const common = require('../common');
common.skipIfInspectorDisabled();

// This test ensures that the debug-brk flag will spin up a new process and
// wait, rather than exit.

// This test ensures that the --debug-brk flag will exit the process
const assert = require('assert');
const fixtures = require('../common/fixtures');
const spawn = require('child_process').spawn;
const { spawnSync } = require('child_process');

// file name here doesn't actually matter since
// debugger will connect regardless of file name arg
// File name here doesn't actually matter the process will exit on start.
const script = fixtures.path('empty.js');

function test(arg) {
const child = spawn(process.execPath, ['--inspect', arg, script]);
const argStr = child.spawnargs.join(' ');
const fail = () => assert.fail(true, false, `'${argStr}' should not quit`);
child.on('exit', fail);

// give node time to start up the debugger
setTimeout(function() {
child.removeListener('exit', fail);
child.kill();
}, 2000);

process.on('exit', function() {
assert(child.killed);
});
const child = spawnSync(process.execPath, ['--inspect', arg, script]);
const stderr = child.stderr.toString();
assert(stderr.includes('DEP0062'));
assert.strictEqual(child.status, 9);
}

test('--debug-brk');
Expand Down

0 comments on commit fa5e097

Please sign in to comment.