From fb00f1f3369c8491fa99c1ad80ddd2e371ebccac Mon Sep 17 00:00:00 2001 From: root Date: Tue, 5 Feb 2019 04:45:36 +0000 Subject: [PATCH] fix flickering progress bars --- archivebox/util.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/archivebox/util.py b/archivebox/util.py index 81da4c20..3eda5103 100644 --- a/archivebox/util.py +++ b/archivebox/util.py @@ -161,14 +161,15 @@ def progress(seconds=TIMEOUT, prefix=''): p = Process(target=progress_bar, args=(seconds, prefix)) p.start() - def end(p=p): + def end(): """immediately finish progress and clear the progressbar line""" # protect from double termination - if p is None or not hasattr(p, 'kill'): - return - - p.kill() + #if p is None or not hasattr(p, 'kill'): + # return + nonlocal p + if p is not None: + p.terminate() p = None sys.stdout.write('\r{}{}\r'.format((' ' * TERM_WIDTH), ANSI['reset'])) # clear whole terminal line