From e620722bb90e15863a3f0fd6c8c4ddbbae6e58a9 Mon Sep 17 00:00:00 2001 From: Nick Sweeting Date: Sun, 20 Jan 2019 12:34:25 -0500 Subject: [PATCH] fix timeouts hanging the progressbar --- archivebox/util.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/archivebox/util.py b/archivebox/util.py index c6384a24..c8d73e03 100644 --- a/archivebox/util.py +++ b/archivebox/util.py @@ -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