guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

02/03: remote: Make sure the user doesn't mess up with the REPL protocol


From: guix-commits
Subject: 02/03: remote: Make sure the user doesn't mess up with the REPL protocol.
Date: Mon, 15 Jul 2019 12:27:29 -0400 (EDT)

civodul pushed a commit to branch master
in repository guix.

commit 6f8eb9f1d8bc8660349658602698db36965bba5d
Author: Ludovic Court├Ęs <address@hidden>
Date:   Mon Jul 15 17:58:01 2019 +0200

    remote: Make sure the user doesn't mess up with the REPL protocol.
    
    Reported by address@hidden (Jakob L. Kreuze).
    
    * guix/remote.scm (trampoline): Wrap 'primitive-load' in
    'with-output-to-port'.
---
 guix/remote.scm | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/guix/remote.scm b/guix/remote.scm
index 0959025..5fecd95 100644
--- a/guix/remote.scm
+++ b/guix/remote.scm
@@ -76,8 +76,14 @@ result to the current output port using the (guix repl) 
protocol."
   (with-imported-modules (source-module-closure '((guix repl)))
     #~(begin
         (use-modules (guix repl))
-        (send-repl-response '(primitive-load #$program)
+
+        ;; We use CURRENT-OUTPUT-PORT for REPL messages, so redirect PROGRAM's
+        ;; output to CURRENT-ERROR-PORT so that it does not interfere.
+        (send-repl-response '(with-output-to-port (current-error-port)
+                               (lambda ()
+                                 (primitive-load #$program)))
                             (current-output-port))
+
         (force-output))))
 
 (define* (remote-eval exp session



reply via email to

[Prev in Thread] Current Thread [Next in Thread]