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

src: remove deprecated node debug command #33648

Closed
wants to merge 3 commits into from
Closed
Changes from 1 commit
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
@@ -1435,12 +1435,15 @@ an officially supported API.
### DEP0068: `node debug`
<!-- YAML
changes:
- version: REPLACEME
pr-url: REPLACEME
description: The legacy `node debug` command was removed.
- version: v8.0.0
pr-url: https://github.com/nodejs/node/pull/11441
description: Runtime deprecation.
-->

Type: Runtime
Type: End-of-life

`node debug` corresponds to the legacy CLI debugger which has been replaced with
a V8-inspector based CLI debugger available through `node inspect`.
10 changes: 5 additions & 5 deletions lib/internal/main/inspect.js
Original file line number Diff line number Diff line change
@@ -8,11 +8,11 @@ const {

prepareMainThreadExecution();

if (process.argv[1] === 'debug') {
process.emitWarning(
'`node debug` is deprecated. Please use `node inspect` instead.',
'DeprecationWarning', 'DEP0068');
}
// if (process.argv[1] === 'debug') {
// process.emitWarning(
// '`node debug` is deprecated. Please use `node inspect` instead.',
// 'DeprecationWarning', 'DEP0068');
// }

markBootstrapComplete();

2 changes: 1 addition & 1 deletion src/node.cc
Original file line number Diff line number Diff line change
@@ -476,7 +476,7 @@ MaybeLocal<Value> StartExecution(Environment* env, StartExecutionCallback cb) {
first_argv = env->argv()[1];
}

if (first_argv == "inspect" || first_argv == "debug") {
if (first_argv == "inspect") {
return StartExecution(env, "internal/main/inspect");
}

29 changes: 0 additions & 29 deletions test/parallel/test-debug-usage.js

This file was deleted.

46 changes: 9 additions & 37 deletions test/parallel/test-debugger-pid.js
Original file line number Diff line number Diff line change
@@ -1,56 +1,28 @@
'use strict';
const common = require('../common');
common.skipIfInspectorDisabled();

if (common.isWindows)
common.skip('unsupported function on windows');

const assert = require('assert');
const spawn = require('child_process').spawn;

let buffer = '';

// Connect to debug agent
const interfacer = spawn(process.execPath, ['debug', '-p', '655555']);
const interfacer = spawn(process.execPath, ['inspect', '-p', '655555']);

interfacer.stdout.setEncoding('utf-8');
interfacer.stderr.setEncoding('utf-8');
const onData = (data) => {
data = (buffer + data).split('\n');
buffer = data.pop();
data.forEach(function(line) {
interfacer.emit('line', line);
});
data.forEach((line) => interfacer.emit('line', line));
};
interfacer.stdout.on('data', onData);
interfacer.stderr.on('data', onData);

let lineCount = 0;
interfacer.on('line', function(line) {
let expected;
const pid = interfacer.pid;
switch (++lineCount) {
case 1:
expected =
new RegExp(`^\\(node:${pid}\\) \\[DEP0068\\] DeprecationWarning: `);
assert.match(line, expected);
break;
case 2:
assert.match(line, /Use `node --trace-deprecation \.\.\.` to show where /);
break;
case 3:
// Doesn't currently work on Windows.
if (!common.isWindows) {
expected = "Target process: 655555 doesn't exist.";
assert.strictEqual(line, expected);
}
break;

default:
if (!common.isWindows)
assert.fail(`unexpected line received: ${line}`);
}
});

interfacer.on('exit', function(code, signal) {
assert.strictEqual(code, 1, `Got unexpected code: ${code}`);
if (!common.isWindows) {
assert.strictEqual(lineCount, 3);
}
});
interfacer.on('line', common.mustCall((line) => {
assert.strictEqual(line, 'Target process: 655555 doesn\'t exist.');
}));