Mercurial > public > mercurial-scm > hg
comparison mercurial/ui.py @ 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 | 17ffb30d9174 |
children | cc16323e748d 31c9e2a702d1 |
comparison
equal
deleted
inserted
replaced
15060:01cdfba22f0c | 15062:0fc95f5cea57 |
---|---|
539 | 539 |
540 # call write() so output goes through subclassed implementation | 540 # call write() so output goes through subclassed implementation |
541 # e.g. color extension on Windows | 541 # e.g. color extension on Windows |
542 self.write(prompt) | 542 self.write(prompt) |
543 | 543 |
544 # instead of trying to emulate raw_input, swap self.fin with sys.stdin | 544 # instead of trying to emulate raw_input, swap (self.fin, |
545 old = sys.stdin | 545 # self.fout) with (sys.stdin, sys.stdout) |
546 oldin = sys.stdin | |
547 oldout = sys.stdout | |
546 sys.stdin = self.fin | 548 sys.stdin = self.fin |
549 sys.stdout = self.fout | |
547 line = raw_input(' ') | 550 line = raw_input(' ') |
548 sys.stdin = old | 551 sys.stdin = oldin |
552 sys.stdout = oldout | |
549 | 553 |
550 # When stdin is in binary mode on Windows, it can cause | 554 # When stdin is in binary mode on Windows, it can cause |
551 # raw_input() to emit an extra trailing carriage return | 555 # raw_input() to emit an extra trailing carriage return |
552 if os.linesep == '\r\n' and line and line[-1] == '\r': | 556 if os.linesep == '\r\n' and line and line[-1] == '\r': |
553 line = line[:-1] | 557 line = line[:-1] |