From: "Ludovic Courtès" <ludo@gnu.org>
To: 36162@debbugs.gnu.org
Subject: [bug#36162] [PATCH 3/4] inferior: Add 'read-repl-response'.
Date: Mon, 10 Jun 2019 23:41:29 +0200 [thread overview]
Message-ID: <20190610214130.19378-3-ludo@gnu.org> (raw)
In-Reply-To: <20190610214130.19378-1-ludo@gnu.org>
* guix/inferior.scm (read-repl-response): New procedure.
(read-inferior-response): Use it.
---
guix/inferior.scm | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/guix/inferior.scm b/guix/inferior.scm
index 63c95141d7..fee97750b6 100644
--- a/guix/inferior.scm
+++ b/guix/inferior.scm
@@ -59,6 +59,7 @@
inferior-eval
inferior-eval-with-store
inferior-object?
+ read-repl-response
inferior-packages
inferior-available-packages
@@ -183,7 +184,8 @@ equivalent. Return #f if the inferior could not be launched."
(set-record-type-printer! <inferior-object> write-inferior-object)
-(define (read-inferior-response inferior)
+(define (read-repl-response port)
+ "Read a (guix repl) response from PORT and return it as a Scheme object."
(define sexp->object
(match-lambda
(('value value)
@@ -191,12 +193,15 @@ equivalent. Return #f if the inferior could not be launched."
(('non-self-quoting address string)
(inferior-object address string))))
- (match (read (inferior-socket inferior))
+ (match (read port)
(('values objects ...)
(apply values (map sexp->object objects)))
(('exception key objects ...)
(apply throw key (map sexp->object objects)))))
+(define (read-inferior-response inferior)
+ (read-repl-response (inferior-socket inferior)))
+
(define (send-inferior-request exp inferior)
(write exp (inferior-socket inferior))
(newline (inferior-socket inferior)))
--
2.21.0
next prev parent reply other threads:[~2019-06-10 21:42 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-10 21:08 [bug#36162] [PATCH 0/4] Add 'remote-eval' Ludovic Courtès
2019-06-10 21:41 ` [bug#36162] [PATCH 1/4] gexp: Add 'lower-gexp' and express 'gexp->derivation' in terms of it Ludovic Courtès
2019-06-10 21:41 ` [bug#36162] [PATCH 2/4] Add (guix repl) Ludovic Courtès
2019-06-10 21:41 ` Ludovic Courtès [this message]
2019-06-10 21:41 ` [bug#36162] [PATCH 4/4] Add (guix remote) Ludovic Courtès
2019-06-11 13:26 ` [bug#36162] [PATCH 0/4] Add 'remote-eval' Ricardo Wurmus
2019-06-11 17:35 ` Jakob L. Kreuze
2019-06-12 13:45 ` Ludovic Courtès
2019-06-12 15:12 ` Jakob L. Kreuze
2019-06-13 11:09 ` Ludovic Courtès
2019-06-13 13:18 ` Jakob L. Kreuze
2019-06-13 16:17 ` Jakob L. Kreuze
2019-06-14 11:20 ` Ludovic Courtès
2019-06-30 13:24 ` Christopher Lemmer Webber
2019-07-04 16:22 ` Ludovic Courtès
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
List information: https://guix.gnu.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190610214130.19378-3-ludo@gnu.org \
--to=ludo@gnu.org \
--cc=36162@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 public inbox
https://git.savannah.gnu.org/cgit/guix.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).