Skip to content

Commit 3bec955

Browse files
committed
add a special case in the stay-connected implementation for when the file is sys.stdin
1 parent 2fa86cb commit 3bec955

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

pybricksdev/cli/__init__.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -268,6 +268,15 @@ async def reconnect_hub():
268268
]
269269
while True:
270270
try:
271+
if args.file is sys.stdin:
272+
await hub.race_disconnect(
273+
hub.race_power_button_press(
274+
questionary.press_any_key_to_continue(
275+
"The hub will stay connected and echo its output to the terminal. Press any key to exit."
276+
).ask_async()
277+
)
278+
)
279+
return
271280
response = await hub.race_disconnect(
272281
hub.race_power_button_press(
273282
questionary.select(
@@ -302,7 +311,7 @@ async def reconnect_hub():
302311
hub = await reconnect_hub()
303312

304313
except asyncio.TimeoutError:
305-
# On windows, it takes significantly longer
314+
# On windows, it can take significantly longer
306315
# for the device to register that the hub was
307316
# disconnected. If _wait_for_user_program_stop
308317
# throws a timeout error, we can assume that the

0 commit comments

Comments
 (0)