comparison mercurial/utils/procutil.py @ 38454:d24ad71ff869

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 aac4be30e250
children 72286f9e324f
comparison
equal deleted inserted replaced
38453:5cdfc20bfd5f 38454:d24ad71ff869
39 except AttributeError: 39 except AttributeError:
40 return False 40 return False
41 41
42 # glibc determines buffering on first write to stdout - if we replace a TTY 42 # glibc determines buffering on first write to stdout - if we replace a TTY
43 # destined stdout with a pipe destined stdout (e.g. pager), we want line 43 # destined stdout with a pipe destined stdout (e.g. pager), we want line
44 # buffering 44 # buffering (or unbuffered, on Windows)
45 if isatty(stdout): 45 if isatty(stdout):
46 stdout = os.fdopen(stdout.fileno(), r'wb', 1) 46 if pycompat.iswindows:
47 # Windows doesn't support line buffering
48 stdout = os.fdopen(stdout.fileno(), r'wb', 0)
49 else:
50 stdout = os.fdopen(stdout.fileno(), r'wb', 1)
47 51
48 if pycompat.iswindows: 52 if pycompat.iswindows:
49 from .. import windows as platform 53 from .. import windows as platform
50 stdout = platform.winstdout(stdout) 54 stdout = platform.winstdout(stdout)
51 else: 55 else: