mirror of
https://git.in.rschanz.org/ryan77627/guix.git
synced 2024-12-24 21:38:07 -05:00
progress: Do not display the last 0B transfer when size is unknown.
* guix/progress.scm (display-download-progress): Don't display anything when both SIZE and TRANSFERRED are null.
This commit is contained in:
parent
0289dc1473
commit
d827fd31ca
1 changed files with 14 additions and 11 deletions
|
@ -212,17 +212,20 @@ (define elapsed
|
|||
(current-terminal-columns))
|
||||
log-port)
|
||||
(force-output log-port))
|
||||
(let* ((throughput (/ transferred elapsed))
|
||||
(left (format #f " ~a" file))
|
||||
(right (format #f "~a/s ~a | ~a transferred"
|
||||
(byte-count->string throughput)
|
||||
(seconds->string elapsed)
|
||||
(byte-count->string transferred))))
|
||||
(erase-current-line log-port)
|
||||
(display (string-pad-middle left right
|
||||
(current-terminal-columns))
|
||||
log-port)
|
||||
(force-output log-port))))
|
||||
;; If we don't know the total size, the last transfer will have a 0B
|
||||
;; size. Don't display it.
|
||||
(unless (zero? transferred)
|
||||
(let* ((throughput (/ transferred elapsed))
|
||||
(left (format #f " ~a" file))
|
||||
(right (format #f "~a/s ~a | ~a transferred"
|
||||
(byte-count->string throughput)
|
||||
(seconds->string elapsed)
|
||||
(byte-count->string transferred))))
|
||||
(erase-current-line log-port)
|
||||
(display (string-pad-middle left right
|
||||
(current-terminal-columns))
|
||||
log-port)
|
||||
(force-output log-port)))))
|
||||
|
||||
(define %progress-interval
|
||||
;; Default interval between subsequent outputs for rate-limited displays.
|
||||
|
|
Loading…
Reference in a new issue