mirror of
https://github.com/ArchiveBox/ArchiveBox.git
synced 2025-05-15 07:34:27 -04:00
fix flickering progress bars
This commit is contained in:
parent
bc6de29a5a
commit
fb00f1f336
1 changed files with 6 additions and 5 deletions
|
@ -161,14 +161,15 @@ def progress(seconds=TIMEOUT, prefix=''):
|
||||||
p = Process(target=progress_bar, args=(seconds, prefix))
|
p = Process(target=progress_bar, args=(seconds, prefix))
|
||||||
p.start()
|
p.start()
|
||||||
|
|
||||||
def end(p=p):
|
def end():
|
||||||
"""immediately finish progress and clear the progressbar line"""
|
"""immediately finish progress and clear the progressbar line"""
|
||||||
|
|
||||||
# protect from double termination
|
# protect from double termination
|
||||||
if p is None or not hasattr(p, 'kill'):
|
#if p is None or not hasattr(p, 'kill'):
|
||||||
return
|
# return
|
||||||
|
nonlocal p
|
||||||
p.kill()
|
if p is not None:
|
||||||
|
p.terminate()
|
||||||
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
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue