summary refs log tree commit diff
path: root/gnu/build/marionette.scm
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2017-09-07 23:31:21 +0200
committerLudovic Courtès <ludo@gnu.org>2017-09-08 00:11:21 +0200
commit13877c34534fc6a1cda25a984007bc0e7d27ebc9 (patch)
treef1b8da83983b74f8106978ead2810f8c581933cf /gnu/build/marionette.scm
parent505760ed08db7399bf5a21fd04272079fe7bca19 (diff)
downloadguix-13877c34534fc6a1cda25a984007bc0e7d27ebc9.tar.gz
marionette: 'wait-for-file' can be passed a read procedure.
* gnu/build/marionette.scm (wait-for-file): Add #:read parameter and
honor it.
* gnu/tests/base.scm (run-basic-test)["login on tty1"]: Use
'wait-for-file' instead of inline code.
Diffstat (limited to 'gnu/build/marionette.scm')
-rw-r--r--gnu/build/marionette.scm7
1 files changed, 4 insertions, 3 deletions
diff --git a/gnu/build/marionette.scm b/gnu/build/marionette.scm
index f35f0fbca1..7554a710a0 100644
--- a/gnu/build/marionette.scm
+++ b/gnu/build/marionette.scm
@@ -165,13 +165,14 @@ QEMU monitor and to the guest's backdoor REPL."
      (newline repl)
      (read repl))))
 
-(define* (wait-for-file file marionette #:key (timeout 10))
-  "Wait until FILE exists in MARIONETTE; 'read' its content and return it.  If
+(define* (wait-for-file file marionette
+                        #:key (timeout 10) (read 'read))
+  "Wait until FILE exists in MARIONETTE; READ its content and return it.  If
 FILE has not shown up after TIMEOUT seconds, raise an error."
   (match (marionette-eval
           `(let loop ((i ,timeout))
              (cond ((file-exists? ,file)
-                    (cons 'success (call-with-input-file ,file read)))
+                    (cons 'success (call-with-input-file ,file ,read)))
                    ((> i 0)
                     (sleep 1)
                     (loop (- i 1)))