Flush progress message buffer in display().
[git.git] / progress.c
index 4bd650f9ba496786029791bc8a0a40b611bdeb63..d19f80c0bb25928383f8a1aff3f6f49f9a65131c 100644 (file)
@@ -98,11 +98,13 @@ static int display(struct progress *progress, unsigned n, const char *done)
                        fprintf(stderr, "%s: %3u%% (%u/%u)%s%s",
                                progress->title, percent, n,
                                progress->total, tp, eol);
+                       fflush(stderr);
                        progress_update = 0;
                        return 1;
                }
        } else if (progress_update) {
                fprintf(stderr, "%s: %u%s%s", progress->title, n, tp, eol);
+               fflush(stderr);
                progress_update = 0;
                return 1;
        }
@@ -207,6 +209,7 @@ struct progress *start_progress_delay(const char *title, unsigned total,
        if (!progress) {
                /* unlikely, but here's a good fallback */
                fprintf(stderr, "%s...\n", title);
+               fflush(stderr);
                return NULL;
        }
        progress->title = title;