Merge pull request #115 from karlicoss/fix-descriptor-leak

Fix 'Too many open files' error.
This commit is contained in:
Nick Sweeting 2018-11-26 16:22:32 -05:00 committed by GitHub
commit c684eb045d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -161,7 +161,13 @@ def progress(seconds=TIMEOUT, prefix=''):
def end():
"""immediately finish progress and clear the progressbar line"""
nonlocal p
if p is None: # protect from double termination
return
p.terminate()
p = None
sys.stdout.write('\r{}{}\r'.format((' ' * TERM_WIDTH), ANSI['reset'])) # clear whole terminal line
sys.stdout.flush()