mirror of
https://github.com/pirate/ArchiveBox.git
synced 2025-08-19 12:51:49 +02:00
better closure
This commit is contained in:
@@ -162,12 +162,11 @@ 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():
|
def end(p=p):
|
||||||
"""immediately finish progress and clear the progressbar line"""
|
"""immediately finish progress and clear the progressbar line"""
|
||||||
|
|
||||||
# protect from double termination
|
# protect from double termination
|
||||||
nonlocal p
|
if p is None or not hasattr(p, 'kill'):
|
||||||
if p is None:
|
|
||||||
return
|
return
|
||||||
|
|
||||||
p.kill()
|
p.kill()
|
||||||
|
Reference in New Issue
Block a user