From 2984d6a5ecd9ac4ac602990f7c6aba848ff59b45 Mon Sep 17 00:00:00 2001 From: Michael Gehring Date: Wed, 5 Oct 2016 20:18:43 +0200 Subject: [PATCH] bin/xbps-install/fetch_cb.c: flush stdout when printing progress --- bin/xbps-install/fetch_cb.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/bin/xbps-install/fetch_cb.c b/bin/xbps-install/fetch_cb.c index 8b715a9a..a0f158d3 100644 --- a/bin/xbps-install/fetch_cb.c +++ b/bin/xbps-install/fetch_cb.c @@ -148,10 +148,12 @@ stat_display(const struct xbps_fetch_cb_data *xfpd, void *cbdata) fprintf(stderr, "%s: [%s %d%%] %s ETA: %s\033[K\r", xfpd->file_name, totsize, percentage, stat_bps(xfpd, xfer), stat_eta(xfpd, xfer)); - else + else { printf("%s: [%s %d%%] %s ETA: %s\n", xfpd->file_name, totsize, percentage, stat_bps(xfpd, xfer), stat_eta(xfpd, xfer)); + fflush(stdout); + } } void @@ -174,9 +176,10 @@ fetch_file_progress_cb(const struct xbps_fetch_cb_data *xfpd, void *cbdata) if (v_tty) fprintf(stderr, "%s: %s [avg rate: %s]\033[K\n", xfpd->file_name, size, stat_bps(xfpd, xfer)); - else + else { printf("%s: %s [avg rate: %s]\n", xfpd->file_name, size, stat_bps(xfpd, xfer)); - + fflush(stdout); + } } }