diff --git a/gnu/tests/mail.scm b/gnu/tests/mail.scm index 298918b3a7..58172cd1d6 100644 --- a/gnu/tests/mail.scm +++ b/gnu/tests/mail.scm @@ -140,16 +140,21 @@ match from any for local action inbound (ice-9 rdelim)) (define (queue-empty?) - (eof-object? - (read-line - (open-input-pipe - (string-append #$(file-append opensmtpd "/sbin/smtpctl") - " show queue"))))) + (let* ((pipe (open-pipe* OPEN_READ + #$(file-append opensmtpd + "/sbin/smtpctl") + "show" "queue")) + (line (read-line pipe))) + (close-pipe pipe) + (eof-object? line))) - (let wait () - (if (queue-empty?) - (file-exists? "/var/mail/root") - (begin (sleep 1) (wait))))) + (let wait ((n 20)) + (cond ((queue-empty?) + (file-exists? "/var/mail/root")) + ((zero? n) + (error "root mailbox didn't show up")) + (else + (sleep 1) (wait (- n 1)))))) marionette)) (test-end)