Skip to content

Commit fcbc218

Browse files
Handle KeyboardInterrupt when control-c is pressed when showing an error.
1 parent 328ee92 commit fcbc218

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/prompt_toolkit/application/application.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1470,7 +1470,10 @@ def _ignore(event: E) -> None:
14701470
session: PromptSession[None] = PromptSession(
14711471
message=wait_text, key_bindings=key_bindings
14721472
)
1473-
await session.app.run_async()
1473+
try:
1474+
await session.app.run_async()
1475+
except KeyboardInterrupt:
1476+
pass # Control-c pressed. Don't propagate this error.
14741477

14751478

14761479
@contextmanager

0 commit comments

Comments
 (0)