mirror of
https://github.com/ArchiveBox/ArchiveBox
synced 2024-11-26 06:00:22 +00:00
fix timeouts hanging the progressbar
This commit is contained in:
parent
7ea36c4adb
commit
e620722bb9
1 changed files with 5 additions and 3 deletions
|
@ -158,16 +158,18 @@ def progress(seconds=TIMEOUT, prefix=''):
|
|||
print()
|
||||
pass
|
||||
|
||||
p = Process(target=progress_bar)
|
||||
p = Process(target=progress_bar, args=(seconds, prefix))
|
||||
p.start()
|
||||
|
||||
def end():
|
||||
"""immediately finish progress and clear the progressbar line"""
|
||||
|
||||
# protect from double termination
|
||||
nonlocal p
|
||||
if p is None: # protect from double termination
|
||||
if p is None:
|
||||
return
|
||||
|
||||
p.terminate()
|
||||
p.kill()
|
||||
p = None
|
||||
|
||||
sys.stdout.write('\r{}{}\r'.format((' ' * TERM_WIDTH), ANSI['reset'])) # clear whole terminal line
|
||||
|
|
Loading…
Reference in a new issue