File tree Expand file tree Collapse file tree 1 file changed +2
-4
lines changed
src/prompt_toolkit/shortcuts/progress_bar Expand file tree Collapse file tree 1 file changed +2
-4
lines changed Original file line number Diff line number Diff line change 5252from prompt_toolkit .layout .dimension import AnyDimension , D
5353from prompt_toolkit .output import ColorDepth , Output
5454from prompt_toolkit .styles import BaseStyle
55+ from prompt_toolkit .utils import in_main_thread
5556
5657from .formatters import Formatter , create_default_formatters
5758
@@ -147,10 +148,7 @@ def __init__(
147148 # If no `cancel_callback` was given, and we're creating the progress
148149 # bar from the main thread. Cancel by sending a `KeyboardInterrupt` to
149150 # the main thread.
150- if (
151- self .cancel_callback is None
152- and threading .currentThread () == threading .main_thread ()
153- ):
151+ if self .cancel_callback is None and in_main_thread ():
154152
155153 def keyboard_interrupt_to_main_thread () -> None :
156154 os .kill (os .getpid (), signal .SIGINT )
You can’t perform that action at this time.
0 commit comments