diff options
author | Sebastian Schuberth <sschuberth@gmail.com> | 2018-07-13 11:47:10 +0200 |
---|---|---|
committer | Sebastian Schuberth <sschuberth@gmail.com> | 2018-07-13 16:23:50 +0200 |
commit | a9399846faa077a8eb15aedb8b498cba7cf3aeba (patch) | |
tree | 089048ac29d73f4984d13133ab5de7099b04d27b | |
parent | b10f0e5b9a9ba6d8e9a27b3a81d2fc1d65d9810d (diff) | |
download | git-repo-a9399846faa077a8eb15aedb8b498cba7cf3aeba.tar.gz |
Flush stderr on Windows
While on Linux stderr is unbuffered, it is buffered on Windows. Always
flush stderr on Windows to ensure any error messages appear in the right
order to ease diagnosing.
Change-Id: I37300e384ecd3a51a321a48818f0114d6f3357a0
-rwxr-xr-x | repo | 4 |
1 files changed, 4 insertions, 0 deletions
@@ -144,6 +144,10 @@ def _print(*objects, **kwargs): | |||
144 | out = kwargs.get('file', sys.stdout) | 144 | out = kwargs.get('file', sys.stdout) |
145 | out.write(sep.join(objects) + end) | 145 | out.write(sep.join(objects) + end) |
146 | 146 | ||
147 | # On Windows stderr is buffered, so flush to maintain the order of error messages. | ||
148 | if out == sys.stderr and platform.system() == "Windows": | ||
149 | out.flush() | ||
150 | |||
147 | 151 | ||
148 | # Python version check | 152 | # Python version check |
149 | ver = sys.version_info | 153 | ver = sys.version_info |