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
|
@ -212,17 +212,20 @@ throughput."
|
||||||
(current-terminal-columns))
|
(current-terminal-columns))
|
||||||
log-port)
|
log-port)
|
||||||
(force-output log-port))
|
(force-output log-port))
|
||||||
(let* ((throughput (/ transferred elapsed))
|
;; If we don't know the total size, the last transfer will have a 0B
|
||||||
(left (format #f " ~a" file))
|
;; size. Don't display it.
|
||||||
(right (format #f "~a/s ~a | ~a transferred"
|
(unless (zero? transferred)
|
||||||
(byte-count->string throughput)
|
(let* ((throughput (/ transferred elapsed))
|
||||||
(seconds->string elapsed)
|
(left (format #f " ~a" file))
|
||||||
(byte-count->string transferred))))
|
(right (format #f "~a/s ~a | ~a transferred"
|
||||||
(erase-current-line log-port)
|
(byte-count->string throughput)
|
||||||
(display (string-pad-middle left right
|
(seconds->string elapsed)
|
||||||
(current-terminal-columns))
|
(byte-count->string transferred))))
|
||||||
log-port)
|
(erase-current-line log-port)
|
||||||
(force-output log-port))))
|
(display (string-pad-middle left right
|
||||||
|
(current-terminal-columns))
|
||||||
|
log-port)
|
||||||
|
(force-output log-port)))))
|
||||||
|
|
||||||
(define %progress-interval
|
(define %progress-interval
|
||||||
;; Default interval between subsequent outputs for rate-limited displays.
|
;; Default interval between subsequent outputs for rate-limited displays.
|
||||||
|
|
Loading…
Reference in New Issue