comparison mercurial/utils/procutil.py @ 38455: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 632b92899203
children c153f440682f
comparison
equal deleted inserted replaced
38425:1322ae04d3d7 38455:0b63a6743010
40 except AttributeError: 40 except AttributeError:
41 return False 41 return False
42 42
43 # glibc determines buffering on first write to stdout - if we replace a TTY 43 # glibc determines buffering on first write to stdout - if we replace a TTY
44 # destined stdout with a pipe destined stdout (e.g. pager), we want line 44 # destined stdout with a pipe destined stdout (e.g. pager), we want line
45 # buffering 45 # buffering (or unbuffered, on Windows)
46 if isatty(stdout): 46 if isatty(stdout):
47 stdout = os.fdopen(stdout.fileno(), r'wb', 1) 47 if pycompat.iswindows:
48 # Windows doesn't support line buffering
49 stdout = os.fdopen(stdout.fileno(), r'wb', 0)
50 else:
51 stdout = os.fdopen(stdout.fileno(), r'wb', 1)
48 52
49 if pycompat.iswindows: 53 if pycompat.iswindows:
50 from .. import windows as platform 54 from .. import windows as platform
51 stdout = platform.winstdout(stdout) 55 stdout = platform.winstdout(stdout)
52 else: 56 else: