1
0
Fork 0
mirror of synced 2024-06-28 19:10:33 +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 = 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()