Commit 65de80b
committed
Handle InvalidStateError during termination when using
In some edge cases, during cancellation, probably when using anyio, we can get
this `InvalidStateError` during termination. This patch fixes that bug.
```
Traceback (most recent call last):
File "/home/jonathan/git/python-prompt-toolkit/src/prompt_toolkit/application/run_in_terminal.py", line 49, in run
async with in_terminal(render_cli_done=render_cli_done):
File "/home/jonathan/.local/share/uv/python/cpython-3.11.10-linux-aarch64-gnu/lib/python3.11/contextlib.py", line 217, in __aexit__
await anext(self.gen)
File "/home/jonathan/git/python-prompt-toolkit/src/prompt_toolkit/application/run_in_terminal.py", line 114, in in_terminal
new_run_in_terminal_f.set_result(None)
asyncio.exceptions.InvalidStateError: invalid state
```run_in_terminal/patch_stdout.1 parent 435bd99 commit 65de80b
1 file changed
+4
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
111 | 111 | | |
112 | 112 | | |
113 | 113 | | |
114 | | - | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
0 commit comments