ソースを参照

fix flickering progress bars

root 6 年 前
コミット
fb00f1f336
1 ファイル変更6 行追加5 行削除
  1. 6 5
      archivebox/util.py

+ 6 - 5
archivebox/util.py

@@ -161,14 +161,15 @@ def progress(seconds=TIMEOUT, prefix=''):
     p = Process(target=progress_bar, args=(seconds, prefix))
     p.start()
 
-    def end(p=p):
+    def end():
         """immediately finish progress and clear the progressbar line"""
 
         # protect from double termination
-        if p is None or not hasattr(p, 'kill'):
-            return
-
-        p.kill()
+        #if p is None or not hasattr(p, 'kill'):
+        #    return
+        nonlocal p
+        if p is not None:
+            p.terminate()
         p = None
 
         sys.stdout.write('\r{}{}\r'.format((' ' * TERM_WIDTH), ANSI['reset']))  # clear whole terminal line