changeset 15062:0fc95f5cea57 stable

ui: also swap sys.stdout with self.fout in _readline In 17ffb30d9174, _readline was changed to output a space using raw_input and this was done using sys.stdout directly, not self.fout. This change broke the command server for JavaHg since it (and other clients) would see a spurious ' ' on stdout and interpret this as an unknown channel.
author Martin Geisler <mg@aragost.com>
date Tue, 30 Aug 2011 14:18:58 +0200
parents 01cdfba22f0c
children c20688b7c061
files mercurial/ui.py
diffstat 1 files changed, 7 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/ui.py	Fri Aug 26 16:07:16 2011 -0500
+++ b/mercurial/ui.py	Tue Aug 30 14:18:58 2011 +0200
@@ -541,11 +541,15 @@
         # e.g. color extension on Windows
         self.write(prompt)
 
-        # instead of trying to emulate raw_input, swap self.fin with sys.stdin
-        old = sys.stdin
+        # instead of trying to emulate raw_input, swap (self.fin,
+        # self.fout) with (sys.stdin, sys.stdout)
+        oldin = sys.stdin
+        oldout = sys.stdout
         sys.stdin = self.fin
+        sys.stdout = self.fout
         line = raw_input(' ')
-        sys.stdin = old
+        sys.stdin = oldin
+        sys.stdout = oldout
 
         # When stdin is in binary mode on Windows, it can cause
         # raw_input() to emit an extra trailing carriage return