mirror of
https://github.com/ArchiveBox/ArchiveBox.git
synced 2025-05-13 22:54:27 -04:00
better closure
This commit is contained in:
parent
db0461ec4e
commit
2c30cd9468
1 changed files with 2 additions and 3 deletions
|
@ -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()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue