aboutsummaryrefslogtreecommitdiff
path: root/guix/ssh.scm
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2020-09-02 23:58:34 +0200
committerLudovic Courtès <ludo@gnu.org>2020-09-02 23:59:24 +0200
commit44c6e6f590b706f1ecfea6a7e7406bbd7cb70736 (patch)
tree8a2b8f8195d99a3baf0777bad1ebeced5138fb76 /guix/ssh.scm
parentde83660dd386b73957fe4ad2dc08ce5b8e1f0e7f (diff)
downloadguix-44c6e6f590b706f1ecfea6a7e7406bbd7cb70736.tar
guix-44c6e6f590b706f1ecfea6a7e7406bbd7cb70736.tar.gz
ssh: Fix progress bar crash when there are zero items to send.
* guix/ssh.scm (notify-transfer-progress): Do nothing when TOTAL is zero.
Diffstat (limited to 'guix/ssh.scm')
-rw-r--r--guix/ssh.scm17
1 files changed, 9 insertions, 8 deletions
diff --git a/guix/ssh.scm b/guix/ssh.scm
index 5f05733f12..e41bffca65 100644
--- a/guix/ssh.scm
+++ b/guix/ssh.scm
@@ -441,14 +441,15 @@ Use SIZES to determine the size of ITEM, which is about to be sent."
(progress-bar % (- (max (current-terminal-columns) 5) 5)))
(force-output port))
- (let ((% (* 100. (/ sent total))))
- (match (vhash-assoc item sizes)
- (#f
- (display-bar %)
- (values port sizes total sent))
- ((_ . size)
- (display-bar %)
- (values port sizes total (+ sent size))))))
+ (unless (zero? total)
+ (let ((% (* 100. (/ sent total))))
+ (match (vhash-assoc item sizes)
+ (#f
+ (display-bar %)
+ (values port sizes total sent))
+ ((_ . size)
+ (display-bar %)
+ (values port sizes total (+ sent size)))))))
(define (notify-transfer-completion port . args)
"Notify the user that the transfer has completed."