clean: flush after each line

Some platforms don't automatically flush after \n, and this causes delay
of the output, and also sometimes incomplete file names appear until the
next chunk is flushed.

Reported here: https://github.com/git-for-windows/git/issues/3706

Signed-off-by: Orgad Shaneh <orgads@gmail.com>
This commit is contained in:
Orgad Shaneh 2023-02-01 10:34:16 +02:00
parent 2fc9e9ca3c
commit 8a1cbb00aa

View file

@ -270,8 +270,10 @@ static int remove_dirs(struct strbuf *path, const char *prefix, int force_flag,
if (!*dir_gone && !quiet) {
int i;
for (i = 0; i < dels.nr; i++)
for (i = 0; i < dels.nr; i++) {
printf(dry_run ? _(msg_would_remove) : _(msg_remove), dels.items[i].string);
fflush(stdout);
}
}
out:
strbuf_release(&realpath);
@ -544,6 +546,7 @@ static int parse_choice(struct menu_stuff *menu_stuff,
clean_print_color(CLEAN_COLOR_ERROR);
printf(_("Huh (%s)?\n"), (*ptr)->buf);
clean_print_color(CLEAN_COLOR_RESET);
fflush(stdout);
continue;
}