comparison mercurial/utils/procutil.py @ 45080:00cdac669614

procutil: split if condition This prepares the code for subsequent changes where we need to differentiate between the two cases.
author Manuel Jacob <me@manueljacob.de>
date Fri, 10 Jul 2020 09:59:36 +0200
parents 8628cd1122d2
children 29a905fe23ae
comparison
equal deleted inserted replaced
45079:8628cd1122d2 45080:00cdac669614
96 96
97 # glibc determines buffering on first write to stdout - if we replace a TTY 97 # glibc determines buffering on first write to stdout - if we replace a TTY
98 # destined stdout with a pipe destined stdout (e.g. pager), we want line 98 # destined stdout with a pipe destined stdout (e.g. pager), we want line
99 # buffering. 99 # buffering.
100 if isatty(stdout): 100 if isatty(stdout):
101 if pycompat.ispy3 or pycompat.iswindows: 101 if pycompat.ispy3:
102 # Python 3 implements its own I/O streams. 102 # Python 3 implements its own I/O streams.
103 # The standard library doesn't offer line-buffered binary streams. 103 # The standard library doesn't offer line-buffered binary streams.
104 stdout = make_line_buffered(stdout)
105 elif pycompat.iswindows:
104 # Python 2 uses the I/O streams provided by the C library. 106 # Python 2 uses the I/O streams provided by the C library.
105 # The Windows C runtime library doesn't support line buffering. 107 # The Windows C runtime library doesn't support line buffering.
106 stdout = make_line_buffered(stdout) 108 stdout = make_line_buffered(stdout)
107 else: 109 else:
108 stdout = os.fdopen(stdout.fileno(), 'wb', 1) 110 stdout = os.fdopen(stdout.fileno(), 'wb', 1)