ui: call write() so the prompt string goes through subclassed implementation stable
authorIdan Kamara <idankk86@gmail.com>
Mon, 01 Aug 2011 19:53:00 +0300
branchstable
changeset 15000 68b5d7005cca
parent 14998 a5d449fc5e07
child 15001 dd74cd1e5d49
ui: call write() so the prompt string goes through subclassed implementation
mercurial/ui.py
--- a/mercurial/ui.py	Mon Aug 01 10:54:10 2011 -0500
+++ b/mercurial/ui.py	Mon Aug 01 19:53:00 2011 +0300
@@ -537,12 +537,15 @@
             except Exception:
                 pass
 
-        # instead of trying to emulate raw_input, swap our in/out
-        # with sys.stdin/out
-        old = sys.stdout, sys.stdin
-        sys.stdout, sys.stdin = self.fout, self.fin
-        line = raw_input(prompt)
-        sys.stdout, sys.stdin = old
+        # call write() so output goes through subclassed implementation
+        # 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
+        sys.stdin = self.fin
+        line = raw_input()
+        sys.stdin = old
 
         # When stdin is in binary mode on Windows, it can cause
         # raw_input() to emit an extra trailing carriage return