flush {stderr,stdout} on init

- (re) fixes #1177
This commit is contained in:
Casper da Costa-Luis 2021-07-04 01:02:57 +01:00
parent f4cc427dc4
commit 63f427b0b8
No known key found for this signature in database
GPG Key ID: F5126E5FBD2512AD
1 changed files with 3 additions and 1 deletions

View File

@ -336,7 +336,9 @@ class tqdm(Comparable):
"""
fp = file
fp_flush = getattr(fp, 'flush', lambda: None) # pragma: no cover
fp_flush()
if fp in (sys.stderr, sys.stdout):
sys.stderr.flush()
sys.stdout.flush()
def fp_write(s):
fp.write(_unicode(s))