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) {
1639
1639
} else if ( this . args . length === 3 ) {
1640
1640
// `node debug -p pid`
1641
1641
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
+ }
1643
1652
isRemote = true ;
1644
1653
} else {
1645
1654
var match = this . args [ 1 ] . match ( / ^ - - p o r t = ( \d + ) $ / ) ;
@@ -1705,7 +1714,7 @@ Interface.prototype.trySpawn = function(cb) {
1705
1714
// If it's failed to connect 10 times then print failed message
1706
1715
if ( connectionAttempts >= 10 ) {
1707
1716
self . stdout . write ( ' failed, please retry\n' ) ;
1708
- return ;
1717
+ process . exit ( 1 ) ;
1709
1718
}
1710
1719
setTimeout ( attemptConnect , 500 ) ;
1711
1720
}
You can’t perform that action at this time.
0 commit comments