changeset 37879:0b63a6743010 stable 4.6.2

procutil: use unbuffered stdout on Windows Windows doesn't support line buffering, treating it as fully buffered. This causes output of slow commands to stutter. We use unbuffered instead.
author Sune Foldager <cryo@cyanite.org>
date Mon, 25 Jun 2018 16:36:14 +0200
parents 1322ae04d3d7
children 77d1fa0fa2e1
files mercurial/utils/procutil.py
diffstat 1 files changed, 6 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/utils/procutil.py	Tue Jun 19 22:45:52 2018 +0900
+++ b/mercurial/utils/procutil.py	Mon Jun 25 16:36:14 2018 +0200
@@ -42,9 +42,13 @@
 
 # glibc determines buffering on first write to stdout - if we replace a TTY
 # destined stdout with a pipe destined stdout (e.g. pager), we want line
-# buffering
+# buffering (or unbuffered, on Windows)
 if isatty(stdout):
-    stdout = os.fdopen(stdout.fileno(), r'wb', 1)
+    if pycompat.iswindows:
+        # Windows doesn't support line buffering
+        stdout = os.fdopen(stdout.fileno(), r'wb', 0)
+    else:
+        stdout = os.fdopen(stdout.fileno(), r'wb', 1)
 
 if pycompat.iswindows:
     from .. import windows as platform