File tree 1 file changed +17
-1
lines changed
lib/common/mobile/ios/simulator
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 {
87
87
attachRequestMessage ,
88
88
this . deviceInfo . identifier
89
89
) ;
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
+ } ) ;
91
107
try {
92
108
socket = await helpers . connectEventuallyUntilTimeout ( async ( ) => {
93
109
return this . $iOSEmulatorServices . connectToPort ( { port } ) ;
You can’t perform that action at this time.
0 commit comments