Skip to content

Commit beb9b26

Browse files
jacobbogdanovjonathanslenders
authored andcommitted
Cancel pending task to prevent unhandled exception
1 parent 11f75c0 commit beb9b26

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

prompt_toolkit/renderer.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -562,7 +562,9 @@ async def wait_for_timeout() -> None:
562562
wait_for_responses(),
563563
wait_for_timeout(),
564564
]
565-
await wait(coroutines, return_when=FIRST_COMPLETED)
565+
_, pending = await wait(coroutines, return_when=FIRST_COMPLETED)
566+
for task in pending:
567+
task.cancel()
566568

567569
def render(
568570
self, app: "Application[Any]", layout: "Layout", is_done: bool = False

0 commit comments

Comments
 (0)