From 1f09aed8346f11c9fd236940b6e500388c394af2 Mon Sep 17 00:00:00 2001 From: =?utf8?q?=EB=A7=88=EB=88=84=EC=97=98?= Date: Fri, 10 Apr 2020 11:27:51 +0000 Subject: [PATCH] interactive: explicitly `fflush` stdout before expecting input MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 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: 마누엘 Signed-off-by: Johannes Schindelin Signed-off-by: Junio C Hamano --- prompt.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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); -- 2.32.0.93.g670b81a890