mirror of
https://github.com/pirate/ArchiveBox.git
synced 2025-08-25 07:20:59 +02:00
fix timeouts hanging the progressbar
This commit is contained in:
@@ -158,16 +158,18 @@ def progress(seconds=TIMEOUT, prefix=''):
|
|||||||
print()
|
print()
|
||||||
pass
|
pass
|
||||||
|
|
||||||
p = Process(target=progress_bar)
|
p = Process(target=progress_bar, args=(seconds, prefix))
|
||||||
p.start()
|
p.start()
|
||||||
|
|
||||||
def end():
|
def end():
|
||||||
"""immediately finish progress and clear the progressbar line"""
|
"""immediately finish progress and clear the progressbar line"""
|
||||||
|
|
||||||
|
# protect from double termination
|
||||||
nonlocal p
|
nonlocal p
|
||||||
if p is None: # protect from double termination
|
if p is None:
|
||||||
return
|
return
|
||||||
|
|
||||||
p.terminate()
|
p.kill()
|
||||||
p = None
|
p = None
|
||||||
|
|
||||||
sys.stdout.write('\r{}{}\r'.format((' ' * TERM_WIDTH), ANSI['reset'])) # clear whole terminal line
|
sys.stdout.write('\r{}{}\r'.format((' ' * TERM_WIDTH), ANSI['reset'])) # clear whole terminal line
|
||||||
|
Reference in New Issue
Block a user