Read about our upcoming Code of Conduct on this issue

Commit 1687550e authored by Manuel Jacob's avatar Manuel Jacob
Browse files

procutil: use 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 00cdac669614
......@@ -91,9 +91,6 @@ else:
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 @@ if isatty(stdout):
# 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)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment