File tree Expand file tree Collapse file tree 1 file changed +2
-6
lines changed
src/prompt_toolkit/shortcuts/progress_bar Expand file tree Collapse file tree 1 file changed +2
-6
lines changed Original file line number Diff line number Diff line change 1616import signal
1717import threading
1818import traceback
19- from asyncio import new_event_loop , set_event_loop
2019from typing import (
2120 Callable ,
2221 Generic ,
@@ -156,7 +155,6 @@ def keyboard_interrupt_to_main_thread() -> None:
156155
157156 self ._thread : threading .Thread | None = None
158157
159- self ._app_loop = new_event_loop ()
160158 self ._has_sigwinch = False
161159 self ._app_started = threading .Event ()
162160
@@ -224,7 +222,6 @@ def width_for_formatter(formatter: Formatter) -> AnyDimension:
224222
225223 # Run application in different thread.
226224 def run () -> None :
227- set_event_loop (self ._app_loop )
228225 try :
229226 self .app .run (pre_run = self ._app_started .set )
230227 except BaseException as e :
@@ -245,12 +242,11 @@ def __exit__(self, *a: object) -> None:
245242 self ._app_started .wait ()
246243
247244 # Quit UI application.
248- if self .app .is_running :
249- self ._app_loop .call_soon_threadsafe (self .app .exit )
245+ if self .app .is_running and self . app . loop is not None :
246+ self .app . loop .call_soon_threadsafe (self .app .exit )
250247
251248 if self ._thread is not None :
252249 self ._thread .join ()
253- self ._app_loop .close ()
254250
255251 def __call__ (
256252 self ,
You can’t perform that action at this time.
0 commit comments