@@ -374,6 +374,15 @@ def wait_for_event(self, filter=None, timeout=None):
374
374
)
375
375
return None
376
376
377
+ def wait_for_events (self , events , timeout = None ):
378
+ """Wait for a list of events in `events` in any order.
379
+ Return the events not hit before the timeout expired"""
380
+ events = events [:] # Make a copy to avoid modifying the input
381
+ while events :
382
+ event = self .wait_for_event (filter = events , timeout = timeout )
383
+ events .remove (event ["event" ])
384
+ return events
385
+
377
386
def wait_for_stopped (self , timeout = None ):
378
387
stopped_events = []
379
388
stopped_event = self .wait_for_event (
@@ -615,9 +624,7 @@ def request_attach(
615
624
response = self .send_recv (command_dict )
616
625
617
626
if response ["success" ]:
618
- # Wait for a 'process' and 'initialized' event in any order
619
- self .wait_for_event (filter = ["process" , "initialized" ])
620
- self .wait_for_event (filter = ["process" , "initialized" ])
627
+ self .wait_for_events (["process" , "initialized" ])
621
628
return response
622
629
623
630
def request_breakpointLocations (
@@ -872,9 +879,7 @@ def request_launch(
872
879
response = self .send_recv (command_dict )
873
880
874
881
if response ["success" ]:
875
- # Wait for a 'process' and 'initialized' event in any order
876
- self .wait_for_event (filter = ["process" , "initialized" ])
877
- self .wait_for_event (filter = ["process" , "initialized" ])
882
+ self .wait_for_events (["process" , "initialized" ])
878
883
return response
879
884
880
885
def request_next (self , threadId , granularity = "statement" ):
0 commit comments