File tree Expand file tree Collapse file tree 1 file changed +11
-2
lines changed
Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -1639,7 +1639,16 @@ Interface.prototype.trySpawn = function(cb) {
16391639 } else if ( this . args . length === 3 ) {
16401640 // `node debug -p pid`
16411641 if ( this . args [ 1 ] === '-p' && / ^ \d + $ / . test ( this . args [ 2 ] ) ) {
1642- process . _debugProcess ( parseInt ( this . args [ 2 ] , 10 ) ) ;
1642+ const pid = parseInt ( this . args [ 2 ] , 10 ) ;
1643+ try {
1644+ process . _debugProcess ( pid ) ;
1645+ } catch ( e ) {
1646+ if ( e . code === 'ESRCH' ) {
1647+ console . error ( 'Target process: ' + pid + ' doesn\'t exist.' ) ;
1648+ process . exit ( 1 ) ;
1649+ }
1650+ throw e ;
1651+ }
16431652 isRemote = true ;
16441653 } else {
16451654 var match = this . args [ 1 ] . match ( / ^ - - p o r t = ( \d + ) $ / ) ;
@@ -1705,7 +1714,7 @@ Interface.prototype.trySpawn = function(cb) {
17051714 // If it's failed to connect 10 times then print failed message
17061715 if ( connectionAttempts >= 10 ) {
17071716 self . stdout . write ( ' failed, please retry\n' ) ;
1708- return ;
1717+ process . exit ( 1 ) ;
17091718 }
17101719 setTimeout ( attemptConnect , 500 ) ;
17111720 }
You can’t perform that action at this time.
0 commit comments