summary refs log tree commit diff
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2019-07-15 17:58:01 +0200
committerLudovic Courtès <ludo@gnu.org>2019-07-15 18:27:22 +0200
commit6f8eb9f1d8bc8660349658602698db36965bba5d (patch)
treebeb22470b912971c8020a72ebc648dacb66fa822
parent5db07b971d5729d349152a4d7ddab80a235ac0a0 (diff)
downloadguix-6f8eb9f1d8bc8660349658602698db36965bba5d.tar.gz
remote: Make sure the user doesn't mess up with the REPL protocol.
Reported by zerodaysfordays@sdf.lonestar.org (Jakob L. Kreuze).

* guix/remote.scm (trampoline): Wrap 'primitive-load' in
'with-output-to-port'.
-rw-r--r--guix/remote.scm8
1 files changed, 7 insertions, 1 deletions
diff --git a/guix/remote.scm b/guix/remote.scm
index 0959025963..5fecd954e9 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