浏览代码

better closure

Nick Sweeting 7 年之前
父节点
当前提交
2c30cd9468
共有 1 个文件被更改,包括 2 次插入3 次删除
  1. 2 3
      archivebox/util.py

+ 2 - 3
archivebox/util.py

@@ -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:
+        if p is None or not hasattr(p, 'kill'):
             return
             return
 
 
         p.kill()
         p.kill()