Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 4cdf000

Browse filesBrowse files
debadree25juanarbol
authored andcommitted
debugger: refactor console in lib/internal/debugger/inspect.js
Refs: #38406 PR-URL: #45847 Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Kohei Ueno <kohei.ueno119@gmail.com>
1 parent 61dbca2 commit 4cdf000
Copy full SHA for 4cdf000

File tree

Expand file treeCollapse file tree

1 file changed

+10
-13
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+10
-13
lines changed
Open diff view settings
Collapse file

‎lib/internal/debugger/inspect.js‎

Copy file name to clipboardExpand all lines: lib/internal/debugger/inspect.js
+10-13Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,6 @@ const {
3232
AbortController,
3333
} = require('internal/abort_controller');
3434

35-
// TODO(aduh95): remove console calls
36-
const console = require('internal/console/global');
37-
3835
const { 0: InspectClient, 1: createRepl } =
3936
[
4037
require('internal/debugger/inspect_client'),
@@ -312,7 +309,7 @@ function parseArgv(args) {
312309
process._debugProcess(pid);
313310
} catch (e) {
314311
if (e.code === 'ESRCH') {
315-
console.error(`Target process: ${pid} doesn't exist.`);
312+
process.stderr.write(`Target process: ${pid} doesn't exist.\n`);
316313
process.exit(1);
317314
}
318315
throw e;
@@ -332,10 +329,10 @@ function startInspect(argv = ArrayPrototypeSlice(process.argv, 2),
332329
if (argv.length < 1) {
333330
const invokedAs = `${process.argv0} ${process.argv[1]}`;
334331

335-
console.error(`Usage: ${invokedAs} script.js`);
336-
console.error(` ${invokedAs} <host>:<port>`);
337-
console.error(` ${invokedAs} --port=<port>`);
338-
console.error(` ${invokedAs} -p <pid>`);
332+
process.stderr.write(`Usage: ${invokedAs} script.js\n` +
333+
` ${invokedAs} <host>:<port>\n` +
334+
` ${invokedAs} --port=<port>\n` +
335+
` ${invokedAs} -p <pid>\n`);
339336
process.exit(1);
340337
}
341338

@@ -346,12 +343,12 @@ function startInspect(argv = ArrayPrototypeSlice(process.argv, 2),
346343

347344
function handleUnexpectedError(e) {
348345
if (e.code !== 'ERR_DEBUGGER_STARTUP_ERROR') {
349-
console.error('There was an internal error in Node.js. ' +
350-
'Please report this bug.');
351-
console.error(e.message);
352-
console.error(e.stack);
346+
process.stderr.write('There was an internal error in Node.js. ' +
347+
'Please report this bug.\n' +
348+
`${e.message}\n${e.stack}\n`);
353349
} else {
354-
console.error(e.message);
350+
process.stderr.write(e.message);
351+
process.stderr.write('\n');
355352
}
356353
if (inspector.child) inspector.child.kill();
357354
process.exit(1);

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.