pFad - Phone/Frame/Anonymizer/Declutterfier! Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

URL: http://github.com/nodejs/node/commit/a235ccd1685b96089ca2e8c175bb39e1ef59afbd

imer-b69241e157469407.css" /> src,test: debug is now an alias for inspect · nodejs/node@a235ccd · GitHub
Skip to content

Commit a235ccd

Browse files
committed
src,test: debug is now an alias for inspect
`node debug` is now an alias of `node inspect`. This is intended to be a minimal change – it does not get rid of the the debugger code. That can be done in a follow-on. PR-URL: #11441 Reviewed-By: bnoordhuis - Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: joshgav - Josh Gavant <josh.gavant@outlook.com> Reviewed-By: cjihrig - Colin Ihrig <cjihrig@gmail.com> Reviewed-By: targos - Michaël Zasso <mic.besace@gmail.com>
1 parent b7608ac commit a235ccd

File tree

8 files changed

+34
-18
lines changed

8 files changed

+34
-18
lines changed

doc/api/deprecations.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -582,6 +582,14 @@ deprecated.
582582
*Note*: `OutgoingMessage.prototype._renderHeaders` was never documented as
583583
an officially supported API.
584584

585+
<a id="DEP0068"></a>
586+
### DEP0068: node debug
587+
588+
Type: Runtime
589+
590+
`node debug` corresponds to the legacy CLI debugger which has been replaced with
591+
a V8-inspector based CLI debugger available through `node inspect`.
592+
585593
[alloc]: buffer.html#buffer_class_method_buffer_alloc_size_fill_encoding
586594
[alloc_unsafe_size]: buffer.html#buffer_class_method_buffer_allocunsafe_size
587595
[`Buffer.allocUnsafeSlow(size)`]: buffer.html#buffer_class_method_buffer_allocunsafeslow_size

lib/internal/bootstrap_node.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,11 +78,13 @@
7878
NativeModule.require('_third_party_main');
7979
});
8080

81-
} else if (process.argv[1] === 'debug') {
82-
// Start the debugger agent
83-
NativeModule.require('_debugger').start();
81+
} else if (process.argv[1] === 'inspect' || process.argv[1] === 'debug') {
82+
if (process.argv[1] === 'debug') {
83+
process.emitWarning(
84+
'`node debug` is deprecated. Please use `node inspect` instead.',
85+
'DeprecationWarning', 'DEP0068');
86+
}
8487

85-
} else if (process.argv[1] === 'inspect') {
8688
// Start the debugger agent
8789
process.nextTick(function() {
8890
NativeModule.require('node-inspect/lib/_inspect').start();

src/inspector_socket_server.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,10 +82,10 @@ void PrintDebuggerReadyMessage(const std::string& host,
8282
return;
8383
}
8484
fprintf(out,
85-
"Debugger listening on port %d.\n"
85+
"Debugger listening on %s:%d.\n"
8686
"Warning: This is an experimental feature "
8787
"and could change at any time.\n",
88-
port);
88+
host.c_str(), port);
8989
if (ids.size() == 1)
9090
fprintf(out, "To start debugging, open the following URL in Chrome:\n");
9191
if (ids.size() > 1)

src/node.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3525,7 +3525,7 @@ static void PrintHelp() {
35253525
// XXX: If you add an option here, please also add it to doc/node.1 and
35263526
// doc/api/cli.md
35273527
printf("Usage: node [options] [ -e script | script.js ] [arguments]\n"
3528-
" node debug script.js [arguments]\n"
3528+
" node inspect script.js [arguments]\n"
35293529
"\n"
35303530
"Options:\n"
35313531
" -v, --version print Node.js version\n"

test/inspector/inspector-helper.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -461,7 +461,7 @@ exports.startNodeForInspectorTest = function(callback,
461461
clearTimeout(timeoutId);
462462
console.log('[err]', text);
463463
if (found) return;
464-
const match = text.match(/Debugger listening on port (\d+)/);
464+
const match = text.match(/Debugger listening on .*:(\d+)/);
465465
found = true;
466466
child.stderr.removeListener('data', dataCallback);
467467
assert.ok(match, text);

test/parallel/test-debug-usage.js

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,20 @@ const spawn = require('child_process').spawn;
66
const child = spawn(process.execPath, ['debug']);
77
child.stderr.setEncoding('utf8');
88

9-
const expectedUsageMessage = `Usage: node debug script.js
10-
node debug <host>:<port>
11-
node debug -p <pid>
12-
`;
9+
const expectedLines = [
10+
/^\(node:\d+\) \[DEP0068\] DeprecationWarning:/,
11+
/^Usage: .*node.* debug script\.js$/,
12+
/^ .*node.* debug <host>:<port>$/
13+
];
14+
1315
let actualUsageMessage = '';
1416
child.stderr.on('data', function(data) {
1517
actualUsageMessage += data.toString();
1618
});
1719

1820
child.on('exit', common.mustCall(function(code) {
21+
const outputLines = actualUsageMessage.split('\n');
1922
assert.strictEqual(code, 1);
20-
assert.strictEqual(actualUsageMessage, expectedUsageMessage);
23+
for (let i = 0; i < expectedLines.length; i++)
24+
assert(expectedLines[i].test(outputLines[i]));
2125
}));

test/parallel/test-debugger-repeat-last.js

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,20 +20,22 @@ proc.stdout.setEncoding('utf8');
2020
let stdout = '';
2121

2222
let sentCommand = false;
23-
let sentEmpty = false;
2423
let sentExit = false;
2524

2625
proc.stdout.on('data', (data) => {
2726
stdout += data;
28-
if (!sentCommand && stdout.includes('> 1')) {
27+
28+
// Send 'n' as the first step.
29+
if (!sentCommand && stdout.includes('> 1 ')) {
2930
setImmediate(() => { proc.stdin.write('n\n'); });
3031
return sentCommand = true;
3132
}
32-
if (!sentEmpty && stdout.includes('> 3')) {
33+
// Send empty (repeat last command) until we reach line 5.
34+
if (sentCommand && !stdout.includes('> 5')) {
3335
setImmediate(() => { proc.stdin.write('\n'); });
34-
return sentEmpty = true;
36+
return true;
3537
}
36-
if (!sentExit && sentCommand && sentEmpty) {
38+
if (!sentExit && stdout.includes('> 5')) {
3739
setTimeout(() => { proc.stdin.write('\n\n\n.exit\n\n\n'); }, 1);
3840
return sentExit = true;
3941
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad © 2024 Your Company Name. All rights reserved.





Check this box to remove all script contents from the fetched content.



Check this box to remove all images from the fetched content.


Check this box to remove all CSS styles from the fetched content.


Check this box to keep images inefficiently compressed and original size.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy