Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

process: move DEP0062 (node --debug) to end-of-life #25828

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
14 changes: 0 additions & 14 deletions lib/internal/bootstrap/node.js
Original file line number Diff line number Diff line change
Expand Up @@ -203,20 +203,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);
}

const { deprecate } = NativeModule.require('internal/util');
{
// Install legacy getters on the `util` binding for typechecking.
Expand Down
11 changes: 11 additions & 0 deletions src/node_options.cc
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,17 @@ void DebugOptions::CheckOptions(std::vector<std::string>* errors) {
"--without-v8-platform");
}
#endif

if (deprecated_debug && !inspector_enabled) {
errors->push_back("[DEP0062]: `node --debug` and `node --debug-brk` "
"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
10 changes: 0 additions & 10 deletions src/node_options.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,16 +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 invalid_invocation() const {
return deprecated_debug && !inspector_enabled;
}

bool wait_for_connect() const {
return break_first_line || break_node_first_line;
}
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 @@ -259,18 +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()));
}

// --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
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