@ -1,6 +1,5 @@
'use strict' ;
const internalUtil = require ( 'internal/util' ) ;
const util = require ( 'util' ) ;
const path = require ( 'path' ) ;
const net = require ( 'net' ) ;
@ -11,6 +10,11 @@ const inherits = util.inherits;
const assert = require ( 'assert' ) ;
const spawn = require ( 'child_process' ) . spawn ;
const Buffer = require ( 'buffer' ) . Buffer ;
const prefix = ` ( ${ process . release . name } : ${ process . pid } ) ` ;
function error ( msg ) {
console . error ( ` ${ prefix } ${ msg } ` ) ;
}
exports . start = function ( argv , stdin , stdout ) {
argv || ( argv = process . argv . slice ( 2 ) ) ;
@ -32,8 +36,8 @@ exports.start = function(argv, stdin, stdout) {
stdin . resume ( ) ;
process . on ( 'uncaughtException' , function ( e ) {
internalUtil . error ( 'There was an internal error in Node\'s debugger. ' +
'Please report this bug.' ) ;
error ( 'There was an internal error in Node\'s debugger. ' +
'Please report this bug.' ) ;
console . error ( e . message ) ;
console . error ( e . stack ) ;
if ( interface_ . child ) interface_ . child . kill ( ) ;
@ -521,7 +525,7 @@ Client.prototype.mirrorObject = function(handle, depth, cb) {
cb = cb || function ( ) { } ;
this . reqLookup ( propertyRefs , function ( err , res ) {
if ( err ) {
internalUtil . error ( 'problem with reqLookup' ) ;
error ( 'problem with reqLookup' ) ;
cb ( null , handle ) ;
return ;
}
@ -1672,7 +1676,7 @@ Interface.prototype.trySpawn = function(cb) {
process . _ debugProcess ( pid ) ;
} catch ( e ) {
if ( e . code === 'ESRCH' ) {
internalUtil . error ( ` Target process: ${ pid } doesn't exist. ` ) ;
error ( ` Target process: ${ pid } doesn't exist. ` ) ;
process . exit ( 1 ) ;
}
throw e ;
@ -1741,7 +1745,7 @@ Interface.prototype.trySpawn = function(cb) {
function connectError ( ) {
// If it's failed to connect 10 times then print failed message
if ( connectionAttempts >= 10 ) {
internalUtil . error ( ' failed to connect, please retry' ) ;
error ( ' failed to connect, please retry' ) ;
process . exit ( 1 ) ;
}
setTimeout ( attemptConnect , 500 ) ;