Skip to content

Commit 391a89d

Browse files
Fix previous commit: move removing of Appliaction.future code to a later point.
The future still needs to be set at the point where the application draws it's final layout before quitting. Otherwise `Application.is_done` will report an incorrect value.
1 parent 7d9bb5b commit 391a89d

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

prompt_toolkit/application/application.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -733,8 +733,6 @@ def flush_input() -> None:
733733
try:
734734
result = await f
735735
finally:
736-
self.future = None # Remove used future again.
737-
738736
# In any case, when the application finishes.
739737
# (Successful, or because of an error.)
740738
try:
@@ -805,6 +803,12 @@ async def _run_async2() -> _AppResult:
805803
# above, but in case of exceptions, that's not always the
806804
# case.
807805
self._is_running = False
806+
807+
# Also remove the Future again. (This brings the
808+
# application back to its initial state, where it also
809+
# doesn't have a Future.)
810+
self.future = None
811+
808812
return result
809813
finally:
810814
if set_exception_handler:

0 commit comments

Comments
 (0)