File tree Expand file tree Collapse file tree 3 files changed +8
-2
lines changed Expand file tree Collapse file tree 3 files changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -168,8 +168,9 @@ def stop_sync(self) -> None:
168
168
self ._transport .stop ()
169
169
self ._dispatcher_fiber .switch ()
170
170
171
- def stop_async (self ) -> None :
171
+ async def stop_async (self ) -> None :
172
172
self ._transport .stop ()
173
+ await self ._transport .wait_until_stopped ()
173
174
174
175
async def wait_for_object_with_known_name (self , guid : str ) -> Any :
175
176
if guid in self ._objects :
Original file line number Diff line number Diff line change @@ -46,8 +46,12 @@ def stop(self) -> None:
46
46
self ._stopped = True
47
47
self ._output .close ()
48
48
49
+ async def wait_until_stopped (self ) -> None :
50
+ await self ._stopped_future
51
+
49
52
async def run (self ) -> None :
50
53
self ._loop = asyncio .get_running_loop ()
54
+ self ._stopped_future : asyncio .Future = asyncio .Future ()
51
55
52
56
driver_env = os .environ .copy ()
53
57
# VSCode's JavaScript Debug Terminal provides it but driver/pkg does not support it
@@ -87,6 +91,7 @@ async def run(self) -> None:
87
91
except asyncio .IncompleteReadError :
88
92
break
89
93
await asyncio .sleep (0 )
94
+ self ._stopped_future .set_result (None )
90
95
91
96
def send (self , message : Dict ) -> None :
92
97
msg = json .dumps (message )
Original file line number Diff line number Diff line change @@ -42,4 +42,4 @@ async def start(self) -> AsyncPlaywright:
42
42
return await self .__aenter__ ()
43
43
44
44
async def __aexit__ (self , * args : Any ) -> None :
45
- self ._connection .stop_async ()
45
+ await self ._connection .stop_async ()
You can’t perform that action at this time.
0 commit comments