File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -254,6 +254,10 @@ async def reconnect_hub():
254254
255255 await hub .connect ()
256256 # re-enable echoing of the hub's stdout
257+ hub .log_file = None
258+ hub .output = []
259+ hub ._stdout_buf .clear ()
260+ hub ._stdout_line_queue = asyncio .Queue ()
257261 hub .print_output = True
258262 hub ._enable_line_handler = True
259263 return hub
@@ -284,13 +288,16 @@ async def reconnect_hub():
284288 else :
285289 exit ()
286290
291+ except HubPowerButtonPressedError :
292+ try :
293+ await hub ._wait_for_user_program_stop (5 )
294+ except HubDisconnectError :
295+ hub = await reconnect_hub ()
296+
287297 except HubDisconnectError :
288298 # let terminal cool off before making a new prompt
289299 await asyncio .sleep (0.3 )
290- hub = reconnect_hub ()
291-
292- except HubPowerButtonPressedError :
293- hub ._wait_for_user_program_stop (5 )
300+ hub = await reconnect_hub ()
294301
295302 finally :
296303 await hub .disconnect ()
You can’t perform that action at this time.
0 commit comments