[pacman-dev] [PATCH] callback.c: only print download status message once with --noprogressbar

Ivy Foster ivy.foster at gmail.com
Tue Jun 7 21:01:13 UTC 2016


Syncing repos and downloading packages with --noprogressbar specified
often prints the status message "downloading $foo..." to several
lines in a row.
---
 src/pacman/callback.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/pacman/callback.c b/src/pacman/callback.c
index ab3e14f..468d657 100644
--- a/src/pacman/callback.c
+++ b/src/pacman/callback.c
@@ -680,8 +680,10 @@ void cb_dl_progress(const char *filename, off_t file_xfered, off_t file_total)
 
 	if(config->noprogressbar || cols == 0 || file_total == -1) {
 		if(file_xfered == 0) {
-			printf(_("downloading %s...\n"), filename);
+			printf(_("downloading %s...\r"), filename);
 			fflush(stdout);
+		} else if(file_xfered == file_total) {
+			putchar('\n');
 		}
 		return;
 	}
-- 
2.8.3
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <https://lists.archlinux.org/pipermail/pacman-dev/attachments/20160607/aba2feac/attachment.asc>


More information about the pacman-dev mailing list