From bfef14abe4b88e76d95d5466ff87324f7427f63a Mon Sep 17 00:00:00 2001 From: James M Snell Date: Thu, 28 May 2020 15:51:57 -0700 Subject: [PATCH 1/3] 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. --- doc/api/deprecations.md | 5 +++- lib/internal/main/inspect.js | 10 +++---- src/node.cc | 2 +- test/parallel/test-debug-usage.js | 29 ------------------- test/parallel/test-debugger-pid.js | 46 ++++++------------------------ 5 files changed, 19 insertions(+), 73 deletions(-) delete mode 100644 test/parallel/test-debug-usage.js diff --git a/doc/api/deprecations.md b/doc/api/deprecations.md index cdfe2a63b03089..b8de350e230809 100644 --- a/doc/api/deprecations.md +++ b/doc/api/deprecations.md @@ -1435,12 +1435,15 @@ an officially supported API. ### DEP0068: `node debug` -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`. diff --git a/lib/internal/main/inspect.js b/lib/internal/main/inspect.js index f6777fe852bcfc..29c17bee1c5aa5 100644 --- a/lib/internal/main/inspect.js +++ b/lib/internal/main/inspect.js @@ -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(); diff --git a/src/node.cc b/src/node.cc index bc8017bdd06029..5070ac97b8b922 100644 --- a/src/node.cc +++ b/src/node.cc @@ -476,7 +476,7 @@ MaybeLocal 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"); } diff --git a/test/parallel/test-debug-usage.js b/test/parallel/test-debug-usage.js deleted file mode 100644 index eb9594f236b35c..00000000000000 --- a/test/parallel/test-debug-usage.js +++ /dev/null @@ -1,29 +0,0 @@ -'use strict'; -const common = require('../common'); -if (!common.hasCrypto) - common.skip('missing crypto'); - -const assert = require('assert'); -const spawn = require('child_process').spawn; - -const child = spawn(process.execPath, ['debug']); -child.stderr.setEncoding('utf8'); - -const expectedLines = [ - /^\(node:\d+\) \[DEP0068\] DeprecationWarning:/, - /Usage: .*node.* debug script\.js\r?\n .*node.* debug :\r?\n .*node.* debug -p \r?\n$/, -]; - -let actualUsageMessage = ''; -child.stderr.on('data', function(data) { - actualUsageMessage += data.toString(); -}); - -child.on('exit', common.mustCall(function(code) { - assert.strictEqual(code, 1); - for (let i = 0; i < expectedLines.length; i++) - assert.ok( - expectedLines[i].test(actualUsageMessage), - `${actualUsageMessage} did not match ${expectedLines[i]}` - ); -})); diff --git a/test/parallel/test-debugger-pid.js b/test/parallel/test-debugger-pid.js index 00f14b2cf5bb61..157939c05c73fe 100644 --- a/test/parallel/test-debugger-pid.js +++ b/test/parallel/test-debugger-pid.js @@ -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.'); +})); From cd226ad80dec38a9985700508947d5c6bb87dcea Mon Sep 17 00:00:00 2001 From: James M Snell Date: Sat, 30 May 2020 11:10:38 -0700 Subject: [PATCH 2/3] [Squash] suggestion Co-authored-by: Ruben Bridgewater --- lib/internal/main/inspect.js | 5 ----- 1 file changed, 5 deletions(-) diff --git a/lib/internal/main/inspect.js b/lib/internal/main/inspect.js index 29c17bee1c5aa5..4873683048cc79 100644 --- a/lib/internal/main/inspect.js +++ b/lib/internal/main/inspect.js @@ -8,11 +8,6 @@ const { prepareMainThreadExecution(); -// if (process.argv[1] === 'debug') { -// process.emitWarning( -// '`node debug` is deprecated. Please use `node inspect` instead.', -// 'DeprecationWarning', 'DEP0068'); -// } markBootstrapComplete(); From a583f35648b83a78e5d8c1dcd2ccb7551dd1a38c Mon Sep 17 00:00:00 2001 From: James M Snell Date: Mon, 1 Jun 2020 07:35:54 -0700 Subject: [PATCH 3/3] [Squash] update pr-url MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Michaƫl Zasso --- doc/api/deprecations.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/api/deprecations.md b/doc/api/deprecations.md index b8de350e230809..e19b0d6a1b3d1a 100644 --- a/doc/api/deprecations.md +++ b/doc/api/deprecations.md @@ -1436,7 +1436,7 @@ an officially supported API.