1
0
Fork 0
mirror of synced 2024-06-24 17:10:21 +12:00

better closure

This commit is contained in:
Nick Sweeting 2019-01-23 01:07:57 -05:00
parent db0461ec4e
commit 2c30cd9468

View file

@ -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()