mercurial/utils/procutil.py
changeset 45056 9694895749ad
parent 45045 8403cc54bc83
child 45077 fa270dcbdb55
--- a/mercurial/utils/procutil.py	Mon Jul 06 17:44:25 2020 +0200
+++ b/mercurial/utils/procutil.py	Mon Jul 06 17:51:18 2020 +0200
@@ -80,9 +80,16 @@
     return LineBufferedWrapper(stream)
 
 
-stderr = pycompat.stderr
-stdin = pycompat.stdin
-stdout = pycompat.stdout
+if pycompat.ispy3:
+    # TODO: .buffer might not exist if std streams were replaced; we'll need
+    # a silly wrapper to make a bytes stream backed by a unicode one.
+    stdin = sys.stdin.buffer
+    stdout = sys.stdout.buffer
+    stderr = sys.stderr.buffer
+else:
+    stdin = sys.stdin
+    stdout = sys.stdout
+    stderr = sys.stderr
 
 if pycompat.iswindows:
     stdout = platform.winstdout(stdout)