Skip to content

Commit a85ce88

Browse files
committed
src: remove deprecated node debug command
The `node debug` command has been deprecated for a while now. There's really no good reason to keep it around. Move to end of life. PR-URL: #33648 Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: Сковорода Никита Андреевич <[email protected]> Reviewed-By: Shelley Vohr <[email protected]>
1 parent 1904e73 commit a85ce88

File tree

5 files changed

+14
-73
lines changed

5 files changed

+14
-73
lines changed

doc/api/deprecations.md

+4-1
Original file line numberDiff line numberDiff line change
@@ -1435,12 +1435,15 @@ an officially supported API.
14351435
### DEP0068: `node debug`
14361436
<!-- YAML
14371437
changes:
1438+
- version: REPLACEME
1439+
pr-url: https://github.com/nodejs/node/pull/33648
1440+
description: The legacy `node debug` command was removed.
14381441
- version: v8.0.0
14391442
pr-url: https://github.com/nodejs/node/pull/11441
14401443
description: Runtime deprecation.
14411444
-->
14421445

1443-
Type: Runtime
1446+
Type: End-of-life
14441447

14451448
`node debug` corresponds to the legacy CLI debugger which has been replaced with
14461449
a V8-inspector based CLI debugger available through `node inspect`.

lib/internal/main/inspect.js

-5
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,6 @@ const {
88

99
prepareMainThreadExecution();
1010

11-
if (process.argv[1] === 'debug') {
12-
process.emitWarning(
13-
'`node debug` is deprecated. Please use `node inspect` instead.',
14-
'DeprecationWarning', 'DEP0068');
15-
}
1611

1712
markBootstrapComplete();
1813

src/node.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -477,7 +477,7 @@ MaybeLocal<Value> StartExecution(Environment* env, StartExecutionCallback cb) {
477477
first_argv = env->argv()[1];
478478
}
479479

480-
if (first_argv == "inspect" || first_argv == "debug") {
480+
if (first_argv == "inspect") {
481481
return StartExecution(env, "internal/main/inspect");
482482
}
483483

test/parallel/test-debug-usage.js

-29
This file was deleted.

test/parallel/test-debugger-pid.js

+9-37
Original file line numberDiff line numberDiff line change
@@ -1,56 +1,28 @@
11
'use strict';
22
const common = require('../common');
33
common.skipIfInspectorDisabled();
4+
5+
if (common.isWindows)
6+
common.skip('unsupported function on windows');
7+
48
const assert = require('assert');
59
const spawn = require('child_process').spawn;
610

711
let buffer = '';
812

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

1216
interfacer.stdout.setEncoding('utf-8');
1317
interfacer.stderr.setEncoding('utf-8');
1418
const onData = (data) => {
1519
data = (buffer + data).split('\n');
1620
buffer = data.pop();
17-
data.forEach(function(line) {
18-
interfacer.emit('line', line);
19-
});
21+
data.forEach((line) => interfacer.emit('line', line));
2022
};
2123
interfacer.stdout.on('data', onData);
2224
interfacer.stderr.on('data', onData);
2325

24-
let lineCount = 0;
25-
interfacer.on('line', function(line) {
26-
let expected;
27-
const pid = interfacer.pid;
28-
switch (++lineCount) {
29-
case 1:
30-
expected =
31-
new RegExp(`^\\(node:${pid}\\) \\[DEP0068\\] DeprecationWarning: `);
32-
assert.match(line, expected);
33-
break;
34-
case 2:
35-
assert.match(line, /Use `node --trace-deprecation \.\.\.` to show where /);
36-
break;
37-
case 3:
38-
// Doesn't currently work on Windows.
39-
if (!common.isWindows) {
40-
expected = "Target process: 655555 doesn't exist.";
41-
assert.strictEqual(line, expected);
42-
}
43-
break;
44-
45-
default:
46-
if (!common.isWindows)
47-
assert.fail(`unexpected line received: ${line}`);
48-
}
49-
});
50-
51-
interfacer.on('exit', function(code, signal) {
52-
assert.strictEqual(code, 1, `Got unexpected code: ${code}`);
53-
if (!common.isWindows) {
54-
assert.strictEqual(lineCount, 3);
55-
}
56-
});
26+
interfacer.on('line', common.mustCall((line) => {
27+
assert.strictEqual(line, 'Target process: 655555 doesn\'t exist.');
28+
}));

0 commit comments

Comments
 (0)