Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author마누엘 <nalla@hamal.uberspace.de>2020-04-10 14:27:51 +0300
committerJunio C Hamano <gitster@pobox.com>2020-04-10 20:27:16 +0300
commit1f09aed8346f11c9fd236940b6e500388c394af2 (patch)
treeb75743fa3e205b88c1ff155dfe6ef1af663e60b4 /prompt.c
parent08d383f23e80e418c844952fcc4e2e635962c292 (diff)
interactive: explicitly `fflush` stdout before expecting input
At least one interactive command writes a prompt to `stdout` and then reads user input on `stdin`: `git clean --interactive`. If the prompt is left in the buffer, the user will not realize the program is waiting for their input. So let's just flush `stdout` before reading the user's input. Signed-off-by: 마누엘 <nalla@hamal.uberspace.de> Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'prompt.c')
-rw-r--r--prompt.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/prompt.c b/prompt.c
index 098dcfb7cf..5ded21a017 100644
--- a/prompt.c
+++ b/prompt.c
@@ -77,8 +77,10 @@ char *git_prompt(const char *prompt, int flags)
int git_read_line_interactively(struct strbuf *line)
{
- int ret = strbuf_getline_lf(line, stdin);
+ int ret;
+ fflush(stdout);
+ ret = strbuf_getline_lf(line, stdin);
if (ret != EOF)
strbuf_trim_trailing_newline(line);