Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/ui.py @ 33625:c2c6a0f7408b stable
ui: make sure buffer is flushed before waiting for user input (issue5587)
Without this patch on Windows 'hg ci -i' hangs waiting for user input
and "examine changes to 'file'? [Ynesfdaq?]" is never displayed (at least
if the diff is sufficiently small). When Ctrl+C is pressed, this prompt
becomes visible, which suggests that the buffer just wasn't flushed.
I've never seen this happening on Linux, but this looks harmless enough
to not platform-gate it.
author | Kostia Balytskyi <ikostia@fb.com> |
---|---|
date | Sat, 05 Aug 2017 13:19:09 -0700 |
parents | cc047a733f69 |
children | cde4cfeb6e3e 86aca74a063b |
comparison
equal
deleted
inserted
replaced
33624:524b13fc711f | 33625:c2c6a0f7408b |
---|---|
1213 pass | 1213 pass |
1214 | 1214 |
1215 # call write() so output goes through subclassed implementation | 1215 # call write() so output goes through subclassed implementation |
1216 # e.g. color extension on Windows | 1216 # e.g. color extension on Windows |
1217 self.write(prompt, prompt=True) | 1217 self.write(prompt, prompt=True) |
1218 self.flush() | |
1218 | 1219 |
1219 # instead of trying to emulate raw_input, swap (self.fin, | 1220 # instead of trying to emulate raw_input, swap (self.fin, |
1220 # self.fout) with (sys.stdin, sys.stdout) | 1221 # self.fout) with (sys.stdin, sys.stdout) |
1221 oldin = sys.stdin | 1222 oldin = sys.stdin |
1222 oldout = sys.stdout | 1223 oldout = sys.stdout |