File tree Expand file tree Collapse file tree 1 file changed +17
-1
lines changed
lib/common/mobile/ios/simulator Expand file tree Collapse file tree 1 file changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -87,7 +87,23 @@ export class IOSSimulator extends IOSDeviceBase implements Mobile.IiOSDevice {
8787 attachRequestMessage ,
8888 this . deviceInfo . identifier
8989 ) ;
90- const port = await super . getDebuggerPort ( appId ) ;
90+
91+ // Retry posting the notification every five seconds, in case the AttachRequest
92+ // event handler wasn't registered when the first one was sent
93+ const postNotificationRetryInterval = setInterval ( ( ) => {
94+ this . $iOSEmulatorServices
95+ . postDarwinNotification (
96+ attachRequestMessage ,
97+ this . deviceInfo . identifier
98+ )
99+ . catch ( ( e ) => this . $logger . error ( e ) ) ;
100+ } , 5e3 ) ;
101+
102+ // the internal retry-mechanism of getDebuggerPort will ensure the above
103+ // interval has a chance to execute multiple times
104+ const port = await super . getDebuggerPort ( appId ) . finally ( ( ) => {
105+ clearInterval ( postNotificationRetryInterval ) ;
106+ } ) ;
91107 try {
92108 socket = await helpers . connectEventuallyUntilTimeout ( async ( ) => {
93109 return this . $iOSEmulatorServices . connectToPort ( { port } ) ;
You can’t perform that action at this time.
0 commit comments