File tree Expand file tree Collapse file tree 1 file changed +16
-1
lines changed Expand file tree Collapse file tree 1 file changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -54,7 +54,7 @@ export class ElectronInterceptor implements Interceptor {
5454 ? await findExecutableInApp ( pathToApplication )
5555 : pathToApplication ;
5656
57- spawn ( cmd , [ `--inspect-brk=${ debugPort } ` ] , {
57+ const appProcess = spawn ( cmd , [ `--inspect-brk=${ debugPort } ` ] , {
5858 stdio : 'inherit' ,
5959 env : Object . assign ( { } ,
6060 process . env ,
@@ -64,6 +64,21 @@ export class ElectronInterceptor implements Interceptor {
6464
6565 let debugClient : ChromeRemoteInterface . CdpClient | undefined ;
6666 let retries = 10 ;
67+
68+ appProcess . on ( 'error' , async ( e ) => {
69+ reportError ( e ) ;
70+
71+ if ( debugClient ) {
72+ // Try to close the debug connection if open, but very carefully
73+ try {
74+ await debugClient . close ( ) ;
75+ } catch ( e ) { }
76+ }
77+
78+ // If we're still in the process of debugging the app, give up.
79+ retries = - 1 ;
80+ } ) ;
81+
6782 while ( ! debugClient && retries >= 0 ) {
6883 try {
6984 debugClient = await ChromeRemoteInterface ( { port : debugPort } ) ;
You can’t perform that action at this time.
0 commit comments