me
/
guix
Archived
1
0
Fork 0

marionette: 'wait-for-file' really raises an error when a file is missing.

* gnu/build/marionette.scm (wait-for-file): Arrange to call 'error' on
the host, not in the guest.
master
Ludovic Courtès 2017-08-27 20:58:33 +02:00
parent a881a40cea
commit 8bd5231485
No known key found for this signature in database
GPG Key ID: 090B11993D9AEBB5
1 changed files with 14 additions and 10 deletions

View File

@ -168,16 +168,20 @@ QEMU monitor and to the guest's backdoor REPL."
(define* (wait-for-file file marionette #:key (timeout 10)) (define* (wait-for-file file marionette #:key (timeout 10))
"Wait until FILE exists in MARIONETTE; 'read' its content and return it. If "Wait until FILE exists in MARIONETTE; 'read' its content and return it. If
FILE has not shown up after TIMEOUT seconds, raise an error." FILE has not shown up after TIMEOUT seconds, raise an error."
(marionette-eval (match (marionette-eval
`(let loop ((i ,timeout)) `(let loop ((i ,timeout))
(cond ((file-exists? ,file) (cond ((file-exists? ,file)
(call-with-input-file ,file read)) (cons 'success (call-with-input-file ,file read)))
((> i 0) ((> i 0)
(sleep 1) (sleep 1)
(loop (- i 1))) (loop (- i 1)))
(else (else
(error "file didn't show up" ,file)))) 'failure)))
marionette)) marionette)
(('success . result)
result)
('failure
(error "file didn't show up" file))))
(define (marionette-control command marionette) (define (marionette-control command marionette)
"Run COMMAND in the QEMU monitor of MARIONETTE. COMMAND is a string such as "Run COMMAND in the QEMU monitor of MARIONETTE. COMMAND is a string such as