comparison mercurial/utils/procutil.py @ 45056:9694895749ad

pycompat: remove pycompat.{stdin,stdout,stderr} All users have been changed to use procutil.{stdin,stdout,stderr}, which provide consistent behavior across platforms and Python versions.
author Manuel Jacob <me@manueljacob.de>
date Mon, 06 Jul 2020 17:51:18 +0200
parents 8403cc54bc83
children fa270dcbdb55
comparison
equal deleted inserted replaced
45055:4c1b4805db57 45056:9694895749ad
78 if isinstance(stream, LineBufferedWrapper): 78 if isinstance(stream, LineBufferedWrapper):
79 return stream 79 return stream
80 return LineBufferedWrapper(stream) 80 return LineBufferedWrapper(stream)
81 81
82 82
83 stderr = pycompat.stderr 83 if pycompat.ispy3:
84 stdin = pycompat.stdin 84 # TODO: .buffer might not exist if std streams were replaced; we'll need
85 stdout = pycompat.stdout 85 # a silly wrapper to make a bytes stream backed by a unicode one.
86 stdin = sys.stdin.buffer
87 stdout = sys.stdout.buffer
88 stderr = sys.stderr.buffer
89 else:
90 stdin = sys.stdin
91 stdout = sys.stdout
92 stderr = sys.stderr
86 93
87 if pycompat.iswindows: 94 if pycompat.iswindows:
88 stdout = platform.winstdout(stdout) 95 stdout = platform.winstdout(stdout)
89 96
90 # 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