diff --git a/doc/api/deprecations.md b/doc/api/deprecations.md index ecaea8f4d9f7ae..169b5a51315465 100644 --- a/doc/api/deprecations.md +++ b/doc/api/deprecations.md @@ -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` diff --git a/lib/internal/bootstrap/node.js b/lib/internal/bootstrap/node.js index 23d72547ae900f..4b630085e349d1 100644 --- a/lib/internal/bootstrap/node.js +++ b/lib/internal/bootstrap/node.js @@ -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. diff --git a/src/node_options.cc b/src/node_options.cc index 8bd8b827faa109..2398ba2bb3cd69 100644 --- a/src/node_options.cc +++ b/src/node_options.cc @@ -30,6 +30,17 @@ void DebugOptions::CheckOptions(std::vector* 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* errors) { diff --git a/src/node_options.h b/src/node_options.h index 50c66ce890bf4c..e68e1cdfd734ca 100644 --- a/src/node_options.h +++ b/src/node_options.h @@ -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; } diff --git a/src/node_process_object.cc b/src/node_process_object.cc index c1f8806110ffef..f83f553c997b66 100644 --- a/src/node_process_object.cc +++ b/src/node_process_object.cc @@ -259,18 +259,6 @@ MaybeLocal 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 { \ diff --git a/test/sequential/test-debugger-debug-brk.js b/test/sequential/test-debugger-debug-brk.js index 086ee2788dee1c..7a13572a06a2a5 100644 --- a/test/sequential/test-debugger-debug-brk.js +++ b/test/sequential/test-debugger-debug-brk.js @@ -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');