~ruther/guix-local

ad5584bf25feb0b3f2e4bb328cedccbb71f42724 — Christopher Baines 3 years ago 0f46d4f
marionette: Avoid read error when wait-for-file file is empty.

Since #<eof> can't be read.

* gnu/build/marionette.scm (wait-for-file): Return "" if file is empty.

Partially-Fixes: https://issues.guix.gnu.org/57827
1 files changed, 8 insertions(+), 1 deletions(-)

M gnu/build/marionette.scm
M gnu/build/marionette.scm => gnu/build/marionette.scm +8 -1
@@ 198,7 198,14 @@ 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
                          (let ((content
                                 (call-with-input-file ,file ,read)))
                            (if (eof-object? content)
                                ;; #<eof> can't be read, so convert to the
                                ;; empty string
                                ""
                                content))))
                   ((> i 0)
                    (sleep 1)
                    (loop (- i 1)))