@@ -32,9 +32,6 @@ const {
32
32
AbortController,
33
33
} = require ( 'internal/abort_controller' ) ;
34
34
35
- // TODO(aduh95): remove console calls
36
- const console = require ( 'internal/console/global' ) ;
37
-
38
35
const { 0 : InspectClient , 1 : createRepl } =
39
36
[
40
37
require ( 'internal/debugger/inspect_client' ) ,
@@ -312,7 +309,7 @@ function parseArgv(args) {
312
309
process . _debugProcess ( pid ) ;
313
310
} catch ( e ) {
314
311
if ( e . code === 'ESRCH' ) {
315
- console . error ( `Target process: ${ pid } doesn't exist.` ) ;
312
+ process . stderr . write ( `Target process: ${ pid } doesn't exist.\n ` ) ;
316
313
process . exit ( 1 ) ;
317
314
}
318
315
throw e ;
@@ -332,10 +329,10 @@ function startInspect(argv = ArrayPrototypeSlice(process.argv, 2),
332
329
if ( argv . length < 1 ) {
333
330
const invokedAs = `${ process . argv0 } ${ process . argv [ 1 ] } ` ;
334
331
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 ` ) ;
339
336
process . exit ( 1 ) ;
340
337
}
341
338
@@ -346,12 +343,12 @@ function startInspect(argv = ArrayPrototypeSlice(process.argv, 2),
346
343
347
344
function handleUnexpectedError ( e ) {
348
345
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` ) ;
353
349
} else {
354
- console . error ( e . message ) ;
350
+ process . stderr . write ( e . message ) ;
351
+ process . stderr . write ( '\n' ) ;
355
352
}
356
353
if ( inspector . child ) inspector . child . kill ( ) ;
357
354
process . exit ( 1 ) ;
0 commit comments