Merge pull request #211 from ebfe/flush-progress
bin/xbps-install/fetch_cb.c: flush stdout when printing progress
This commit is contained in:
commit
c3068808a2
@ -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",
|
fprintf(stderr, "%s: [%s %d%%] %s ETA: %s\033[K\r",
|
||||||
xfpd->file_name, totsize, percentage,
|
xfpd->file_name, totsize, percentage,
|
||||||
stat_bps(xfpd, xfer), stat_eta(xfpd, xfer));
|
stat_bps(xfpd, xfer), stat_eta(xfpd, xfer));
|
||||||
else
|
else {
|
||||||
printf("%s: [%s %d%%] %s ETA: %s\n",
|
printf("%s: [%s %d%%] %s ETA: %s\n",
|
||||||
xfpd->file_name, totsize, percentage,
|
xfpd->file_name, totsize, percentage,
|
||||||
stat_bps(xfpd, xfer), stat_eta(xfpd, xfer));
|
stat_bps(xfpd, xfer), stat_eta(xfpd, xfer));
|
||||||
|
fflush(stdout);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -174,9 +176,10 @@ fetch_file_progress_cb(const struct xbps_fetch_cb_data *xfpd, void *cbdata)
|
|||||||
if (v_tty)
|
if (v_tty)
|
||||||
fprintf(stderr, "%s: %s [avg rate: %s]\033[K\n",
|
fprintf(stderr, "%s: %s [avg rate: %s]\033[K\n",
|
||||||
xfpd->file_name, size, stat_bps(xfpd, xfer));
|
xfpd->file_name, size, stat_bps(xfpd, xfer));
|
||||||
else
|
else {
|
||||||
printf("%s: %s [avg rate: %s]\n",
|
printf("%s: %s [avg rate: %s]\n",
|
||||||
xfpd->file_name, size, stat_bps(xfpd, xfer));
|
xfpd->file_name, size, stat_bps(xfpd, xfer));
|
||||||
|
fflush(stdout);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user