From a9399846faa077a8eb15aedb8b498cba7cf3aeba Mon Sep 17 00:00:00 2001 From: Sebastian Schuberth Date: Fri, 13 Jul 2018 11:47:10 +0200 Subject: [PATCH] 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 --- repo | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/repo b/repo index 13ccd2ba..3ae38360 100755 --- a/repo +++ b/repo @@ -144,6 +144,10 @@ def _print(*objects, **kwargs): out = kwargs.get('file', sys.stdout) out.write(sep.join(objects) + end) + # On Windows stderr is buffered, so flush to maintain the order of error messages. + if out == sys.stderr and platform.system() == "Windows": + out.flush() + # Python version check ver = sys.version_info