mirror of
https://git.in.rschanz.org/ryan77627/guix.git
synced 2024-11-07 07:26:13 -05:00
inferior: Add 'read-repl-response'.
* guix/inferior.scm (read-repl-response): New procedure. (read-inferior-response): Use it.
This commit is contained in:
parent
92a4087bf4
commit
d0ffa321dd
1 changed files with 7 additions and 2 deletions
|
@ -59,6 +59,7 @@ (define-module (guix inferior)
|
|||
inferior-eval
|
||||
inferior-eval-with-store
|
||||
inferior-object?
|
||||
read-repl-response
|
||||
|
||||
inferior-packages
|
||||
inferior-available-packages
|
||||
|
@ -183,7 +184,8 @@ (define (write-inferior-object object port)
|
|||
|
||||
(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 @@ (define sexp->object
|
|||
(('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)))
|
||||
|
|
Loading…
Reference in a new issue