changeset 43377:aaa046919043 stable

ui: flush before prompting for input with readline I was using `hg absorb` with Python 3 and noticed that the prompt was appearing without any output about what would be done. After I answered the prompt, the output was printed to stdout. This appears to be a buffering difference between Python 2 and Python 3. To work around it, this commit adds an explicit flush() before calling the raw input function when readline is used.
author Gregory Szorc <gregory.szorc@gmail.com>
date Sat, 02 Nov 2019 15:33:39 -0700
parents b27cf9f52194
children 2d31ef3fb494
files mercurial/ui.py
diffstat 1 files changed, 1 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/ui.py	Fri Nov 01 21:46:34 2019 -0700
+++ b/mercurial/ui.py	Sat Nov 02 15:33:39 2019 -0700
@@ -1564,6 +1564,7 @@
         # - http://bugs.python.org/issue12833
         with self.timeblockedsection(b'stdio'):
             if usereadline:
+                self.flush()
                 prompt = encoding.strfromlocal(prompt)
                 line = encoding.strtolocal(pycompat.rawinput(prompt))
                 # When stdin is in binary mode on Windows, it can cause