ui: make sure buffer is flushed before waiting for user input (issue5587) stable
authorKostia Balytskyi <ikostia@fb.com>
Sat, 05 Aug 2017 13:19:09 -0700
branchstable
changeset 33627 c2c6a0f7408b
parent 33626 524b13fc711f
child 33628 aa7a3f6e3729
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.
mercurial/ui.py
--- a/mercurial/ui.py	Wed Aug 02 22:51:19 2017 +0900
+++ b/mercurial/ui.py	Sat Aug 05 13:19:09 2017 -0700
@@ -1215,6 +1215,7 @@
         # call write() so output goes through subclassed implementation
         # e.g. color extension on Windows
         self.write(prompt, prompt=True)
+        self.flush()
 
         # instead of trying to emulate raw_input, swap (self.fin,
         # self.fout) with (sys.stdin, sys.stdout)