Skip to content

Commit fa5e097

Browse files
committed
process: move DEP0062 (node --debug) to end-of-life
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 <[email protected]> Reviewed-By: Eugene Ostroukhov <[email protected]> Reviewed-By: Richard Lau <[email protected]> Reviewed-By: Matteo Collina <[email protected]>
1 parent 154efc9 commit fa5e097

File tree

6 files changed

+16
-41
lines changed

6 files changed

+16
-41
lines changed

doc/api/deprecations.md

+4-1
Original file line numberDiff line numberDiff line change
@@ -1279,9 +1279,12 @@ changes:
12791279
- version: v8.0.0
12801280
pr-url: https://github.com/nodejs/node/pull/10970
12811281
description: Runtime deprecation.
1282+
- version: REPLACEME
1283+
pr-url: https://github.com/nodejs/node/pull/25828
1284+
description: End-of-Life.
12821285
-->
12831286

1284-
Type: Runtime
1287+
Type: End-Of-Life
12851288

12861289
`--debug` activates the legacy V8 debugger interface, which was removed as
12871290
of V8 5.8. It is replaced by Inspector which is activated with `--inspect`

lib/internal/bootstrap/node.js

-8
Original file line numberDiff line numberDiff line change
@@ -203,14 +203,6 @@ Object.defineProperty(process, 'argv0', {
203203
});
204204
process.argv[0] = process.execPath;
205205

206-
// Handle `--debug*` deprecation and invalidation.
207-
if (process._deprecatedDebugBrk) {
208-
process.emitWarning(
209-
'`node --inspect --debug-brk` is deprecated. ' +
210-
'Please use `node --inspect-brk` instead.',
211-
'DeprecationWarning', 'DEP0062', undefined, true);
212-
}
213-
214206
const { deprecate } = NativeModule.require('internal/util');
215207
{
216208
// Install legacy getters on the `util` binding for typechecking.

src/node_options.cc

+5
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,11 @@ void DebugOptions::CheckOptions(std::vector<std::string>* errors) {
3636
"are invalid. Please use `node --inspect` or "
3737
"`node --inspect-brk` instead.");
3838
}
39+
40+
if (deprecated_debug && inspector_enabled && break_first_line) {
41+
errors->push_back("[DEP0062]: `node --inspect --debug-brk` is deprecated. "
42+
"Please use `node --inspect-brk` instead.");
43+
}
3944
}
4045

4146
void PerProcessOptions::CheckOptions(std::vector<std::string>* errors) {

src/node_options.h

-6
Original file line numberDiff line numberDiff line change
@@ -75,12 +75,6 @@ class DebugOptions : public Options {
7575

7676
HostPort host_port{"127.0.0.1", kDefaultInspectorPort};
7777

78-
bool deprecated_invocation() const {
79-
return deprecated_debug &&
80-
inspector_enabled &&
81-
break_first_line;
82-
}
83-
8478
bool wait_for_connect() const {
8579
return break_first_line || break_node_first_line;
8680
}

src/node_process_object.cc

-6
Original file line numberDiff line numberDiff line change
@@ -259,12 +259,6 @@ MaybeLocal<Object> CreateProcessObject(
259259
"_breakNodeFirstLine", True(env->isolate()));
260260
}
261261

262-
// --inspect --debug-brk
263-
if (env->options()->debug_options().deprecated_invocation()) {
264-
READONLY_DONT_ENUM_PROPERTY(process,
265-
"_deprecatedDebugBrk", True(env->isolate()));
266-
}
267-
268262
// --security-revert flags
269263
#define V(code, _, __) \
270264
do { \

test/sequential/test-debugger-debug-brk.js

+7-20
Original file line numberDiff line numberDiff line change
@@ -2,32 +2,19 @@
22
const common = require('../common');
33
common.skipIfInspectorDisabled();
44

5-
// This test ensures that the debug-brk flag will spin up a new process and
6-
// wait, rather than exit.
7-
5+
// This test ensures that the --debug-brk flag will exit the process
86
const assert = require('assert');
97
const fixtures = require('../common/fixtures');
10-
const spawn = require('child_process').spawn;
8+
const { spawnSync } = require('child_process');
119

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

1613
function test(arg) {
17-
const child = spawn(process.execPath, ['--inspect', arg, script]);
18-
const argStr = child.spawnargs.join(' ');
19-
const fail = () => assert.fail(true, false, `'${argStr}' should not quit`);
20-
child.on('exit', fail);
21-
22-
// give node time to start up the debugger
23-
setTimeout(function() {
24-
child.removeListener('exit', fail);
25-
child.kill();
26-
}, 2000);
27-
28-
process.on('exit', function() {
29-
assert(child.killed);
30-
});
14+
const child = spawnSync(process.execPath, ['--inspect', arg, script]);
15+
const stderr = child.stderr.toString();
16+
assert(stderr.includes('DEP0062'));
17+
assert.strictEqual(child.status, 9);
3118
}
3219

3320
test('--debug-brk');

0 commit comments

Comments
 (0)