@@ -10,7 +10,7 @@ import { Interceptor } from '.';
1010
1111import { HtkConfig } from '../config' ;
1212import { delay } from '../util/promise' ;
13- import { isErrorLike } from '../util/error' ;
13+ import { ErrorLike , isErrorLike } from '../util/error' ;
1414import { canAccess , readFile } from '../util/fs' ;
1515import { windowsClose } from '../util/process-management' ;
1616import { getTerminalEnvVars , OVERRIDES_DIR } from './terminal/terminal-env-overrides' ;
@@ -80,6 +80,7 @@ export class ElectronInterceptor implements Interceptor {
8080
8181 let debugClient : ChromeRemoteInterface . Client | undefined ;
8282 let retries = 10 ;
83+ let spawnError : ErrorLike | undefined ;
8384
8485 appProcess . on ( 'error' , async ( e ) => {
8586 reportError ( e ) ;
@@ -92,10 +93,10 @@ export class ElectronInterceptor implements Interceptor {
9293 }
9394
9495 // If we're still in the process of debugging the app, give up.
95- retries = - 1 ;
96+ spawnError = e as ErrorLike ;
9697 } ) ;
9798
98- while ( ! debugClient && retries >= 0 ) {
99+ while ( ! debugClient && retries >= 0 && ! spawnError ) {
99100 try {
100101 debugClient = await ChromeRemoteInterface ( {
101102 host : '127.0.0.1' ,
@@ -110,6 +111,8 @@ export class ElectronInterceptor implements Interceptor {
110111 await delay ( 500 ) ;
111112 }
112113 }
114+
115+ if ( spawnError ) throw spawnError ;
113116 if ( ! debugClient ) throw new Error ( 'Could not initialize CDP client' ) ;
114117
115118 this . debugClients [ proxyPort ] = this . debugClients [ proxyPort ] || [ ] ;
0 commit comments