diff options
author | Christopher Baines <mail@cbaines.net> | 2022-09-16 09:20:25 +0200 |
---|---|---|
committer | Christopher Baines <mail@cbaines.net> | 2022-09-16 11:59:42 +0200 |
commit | ad5584bf25feb0b3f2e4bb328cedccbb71f42724 (patch) | |
tree | d4d1042200110a449b2155d41f3148841769799d /gnu/build/marionette.scm | |
parent | 0f46d4f1477b0446abd089f842ac7409963cc4f1 (diff) | |
download | guix-ad5584bf25feb0b3f2e4bb328cedccbb71f42724.tar guix-ad5584bf25feb0b3f2e4bb328cedccbb71f42724.tar.gz |
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
Diffstat (limited to 'gnu/build/marionette.scm')
-rw-r--r-- | gnu/build/marionette.scm | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/gnu/build/marionette.scm b/gnu/build/marionette.scm index fd59a4c72f..5ebf783892 100644 --- a/gnu/build/marionette.scm +++ b/gnu/build/marionette.scm @@ -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))) |