changeset 45094:b4c35e439ea5

procutil: move assignments This should probably be part of the previous patch, but folding it results in a less useful word diff, so I decided to keep it separate for review.
author Manuel Jacob <me@manueljacob.de>
date Sat, 11 Jul 2020 07:47:04 +0200
parents 63196198dbf0
children 8e04607023e5
files mercurial/utils/procutil.py
diffstat 1 files changed, 2 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/utils/procutil.py	Fri Jul 10 10:12:04 2020 +0200
+++ b/mercurial/utils/procutil.py	Sat Jul 11 07:47:04 2020 +0200
@@ -86,15 +86,14 @@
     # 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
     if isatty(stdout):
         # The standard library doesn't offer line-buffered binary streams.
         stdout = make_line_buffered(stdout)
+    stderr = sys.stderr.buffer
 else:
     # Python 2 uses the I/O streams provided by the C library.
     stdin = sys.stdin
     stdout = sys.stdout
-    stderr = sys.stderr
     if isatty(stdout):
         if pycompat.iswindows:
             # Work around size limit when writing to console.
@@ -106,6 +105,7 @@
             # replace a TTY destined stdout with a pipe destined stdout (e.g.
             # pager), we want line buffering.
             stdout = os.fdopen(stdout.fileno(), 'wb', 1)
+    stderr = sys.stderr
 
 
 findexe = platform.findexe