From 2c30cd946865ac0f4ead876c7f97427a025efa63 Mon Sep 17 00:00:00 2001 From: Nick Sweeting Date: Wed, 23 Jan 2019 01:07:57 -0500 Subject: [PATCH] better closure --- archivebox/util.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/archivebox/util.py b/archivebox/util.py index 70d7e544..2a5dc468 100644 --- a/archivebox/util.py +++ b/archivebox/util.py @@ -162,12 +162,11 @@ def progress(seconds=TIMEOUT, prefix=''): p = Process(target=progress_bar, args=(seconds, prefix)) p.start() - def end(): + def end(p=p): """immediately finish progress and clear the progressbar line""" # protect from double termination - nonlocal p - if p is None: + if p is None or not hasattr(p, 'kill'): return p.kill()