all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Christopher Baines <mail@cbaines.net>
To: 57850@debbugs.gnu.org
Subject: [bug#57850] [PATCH 2/2] marionette: Avoid read error when wait-for-file file is empty.
Date: Fri, 16 Sep 2022 09:32:36 +0200	[thread overview]
Message-ID: <20220916073236.23634-2-mail@cbaines.net> (raw)
In-Reply-To: <20220916073236.23634-1-mail@cbaines.net>

Since #<eof> can't be read.

* gnu/build/marionette.scm (wait-for-file): Return "" if file is empty.
---
 gnu/build/marionette.scm | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

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 @@ (define* (wait-for-file file marionette
   (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)))
-- 
2.37.3





  reply	other threads:[~2022-09-16  7:33 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-16  7:26 [bug#57850] Marionette fix + improvement Christopher Baines
2022-09-16  7:32 ` [bug#57850] [PATCH 1/2] marionette: Make it easier to debug REPL read failures Christopher Baines
2022-09-16  7:32   ` Christopher Baines [this message]
2022-09-16  8:38     ` [bug#57850] Marionette fix + improvement Mathieu Othacehe
2022-09-16 10:40       ` bug#57850: " Christopher Baines
2022-09-16  8:37   ` [bug#57850] " Mathieu Othacehe

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220916073236.23634-2-mail@cbaines.net \
    --to=mail@cbaines.net \
    --cc=57850@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.