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 52
52
from prompt_toolkit .layout .dimension import AnyDimension , D
53
53
from prompt_toolkit .output import ColorDepth , Output
54
54
from prompt_toolkit .styles import BaseStyle
55
+ from prompt_toolkit .utils import in_main_thread
55
56
56
57
from .formatters import Formatter , create_default_formatters
57
58
@@ -147,10 +148,7 @@ def __init__(
147
148
# If no `cancel_callback` was given, and we're creating the progress
148
149
# bar from the main thread. Cancel by sending a `KeyboardInterrupt` to
149
150
# 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 ():
154
152
155
153
def keyboard_interrupt_to_main_thread () -> None :
156
154
os .kill (os .getpid (), signal .SIGINT )
You can’t perform that action at this time.
0 commit comments