Mercurial > hg
changeset 45081:29a905fe23ae
procutil: use mercurial.windows.winstdout only on Python 2 and TTYs
Python 3 already works around the bug. The workaround is only needed when
writing to consoles. If stdout is a console, sys.stdout.isatty() is true.
author | Manuel Jacob <me@manueljacob.de> |
---|---|
date | Fri, 10 Jul 2020 10:03:05 +0200 |
parents | 00cdac669614 |
children | b6afe1c52964 |
files | mercurial/utils/procutil.py |
diffstat | 1 files changed, 2 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/utils/procutil.py Fri Jul 10 09:59:36 2020 +0200 +++ b/mercurial/utils/procutil.py Fri Jul 10 10:03:05 2020 +0200 @@ -91,9 +91,6 @@ stdout = sys.stdout stderr = sys.stderr -if pycompat.iswindows: - stdout = platform.winstdout(stdout) - # 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. @@ -103,6 +100,8 @@ # The standard library doesn't offer line-buffered binary streams. stdout = make_line_buffered(stdout) elif pycompat.iswindows: + # Work around size limit when writing to console. + stdout = platform.winstdout(stdout) # Python 2 uses the I/O streams provided by the C library. # The Windows C runtime library doesn't support line buffering. stdout = make_line_buffered(stdout)