Skip to content
Snippets Groups Projects
Commit 29a905fe authored by Manuel Jacob's avatar Manuel Jacob
Browse files

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.
parent 00cdac66
Branches
Tags
No related merge requests found
......@@ -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)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment