diff mercurial/chgserver.py @ 39840:a9f56e4501c1

merge with stable
author Gregory Szorc <gregory.szorc@gmail.com>
date Wed, 26 Sep 2018 08:46:56 -0700
parents 7cdd47d9ccf8 23a00bc90a3c
children e5fbdc3659fc
line wrap: on
line diff
--- a/mercurial/chgserver.py	Tue Sep 25 08:53:20 2018 -0700
+++ b/mercurial/chgserver.py	Wed Sep 26 08:46:56 2018 -0700
@@ -198,13 +198,15 @@
                 self._csystem = csystem
 
         def _runsystem(self, cmd, environ, cwd, out):
-            # fallback to the original system method if the output needs to be
-            # captured (to self._buffers), or the output stream is not stdout
-            # (e.g. stderr, cStringIO), because the chg client is not aware of
-            # these situations and will behave differently (write to stdout).
+            # fallback to the original system method if
+            #  a. the output stream is not stdout (e.g. stderr, cStringIO),
+            #  b. or stdout is redirected by protectstdio(),
+            # because the chg client is not aware of these situations and
+            # will behave differently (i.e. write to stdout).
             if (out is not self.fout
                 or not util.safehasattr(self.fout, 'fileno')
-                or self.fout.fileno() != procutil.stdout.fileno()):
+                or self.fout.fileno() != procutil.stdout.fileno()
+                or self._finoutredirected):
                 return procutil.system(cmd, environ=environ, cwd=cwd, out=out)
             self.flush()
             return self._csystem(cmd, procutil.shellenviron(environ), cwd)