##// END OF EJS Templates
procutil: distribute code for stdout...
Manuel Jacob -
r45653:63196198 default
parent child Browse files
Show More
@@ -81,32 +81,31 b' def make_line_buffered(stream):'
81 81
82 82
83 83 if pycompat.ispy3:
84 # Python 3 implements its own I/O streams.
84 85 # TODO: .buffer might not exist if std streams were replaced; we'll need
85 86 # a silly wrapper to make a bytes stream backed by a unicode one.
86 87 stdin = sys.stdin.buffer
87 88 stdout = sys.stdout.buffer
88 89 stderr = sys.stderr.buffer
90 if isatty(stdout):
91 # The standard library doesn't offer line-buffered binary streams.
92 stdout = make_line_buffered(stdout)
89 93 else:
94 # Python 2 uses the I/O streams provided by the C library.
90 95 stdin = sys.stdin
91 96 stdout = sys.stdout
92 97 stderr = sys.stderr
93
94 if isatty(stdout):
95 if pycompat.ispy3:
96 # Python 3 implements its own I/O streams.
97 # The standard library doesn't offer line-buffered binary streams.
98 stdout = make_line_buffered(stdout)
99 elif pycompat.iswindows:
100 # Work around size limit when writing to console.
101 stdout = platform.winstdout(stdout)
102 # Python 2 uses the I/O streams provided by the C library.
103 # The Windows C runtime library doesn't support line buffering.
104 stdout = make_line_buffered(stdout)
105 else:
106 # glibc determines buffering on first write to stdout - if we
107 # replace a TTY destined stdout with a pipe destined stdout (e.g.
108 # pager), we want line buffering.
109 stdout = os.fdopen(stdout.fileno(), 'wb', 1)
98 if isatty(stdout):
99 if pycompat.iswindows:
100 # Work around size limit when writing to console.
101 stdout = platform.winstdout(stdout)
102 # The Windows C runtime library doesn't support line buffering.
103 stdout = make_line_buffered(stdout)
104 else:
105 # glibc determines buffering on first write to stdout - if we
106 # replace a TTY destined stdout with a pipe destined stdout (e.g.
107 # pager), we want line buffering.
108 stdout = os.fdopen(stdout.fileno(), 'wb', 1)
110 109
111 110
112 111 findexe = platform.findexe
General Comments 0
You need to be logged in to leave comments. Login now