build-system/julia: Avoid module cycles.
[jackhill/guix/guix.git] / guix / remote.scm
index d8124e4..c00585d 100644 (file)
@@ -19,6 +19,7 @@
 (define-module (guix remote)
   #:use-module (guix ssh)
   #:use-module (guix gexp)
+  #:use-module (guix i18n)
   #:use-module (guix inferior)
   #:use-module (guix store)
   #:use-module (guix monads)
@@ -26,6 +27,7 @@
   #:use-module (guix derivations)
   #:use-module (guix utils)
   #:use-module (ssh popen)
+  #:use-module (ssh channel)
   #:use-module (srfi srfi-1)
   #:use-module (srfi srfi-34)
   #:use-module (srfi srfi-35)
@@ -67,10 +69,13 @@ BECOME-COMMAND is given, use that to invoke the remote Guile REPL."
 
   (let ((pipe (apply open-remote-pipe* session OPEN_READ repl-command)))
     (when (eof-object? (peek-char pipe))
-      (raise (condition
-              (&message
-               (message (format #f (G_ "failed to run '~{~a~^ ~}'")
-                                repl-command))))))
+      (let ((status (channel-get-exit-status pipe)))
+        (close-port pipe)
+        (raise (condition
+                (&message
+                 (message (format #f (G_ "remote command '~{~a~^ ~}' failed \
+with status ~a")
+                                  repl-command status)))))))
     pipe))
 
 (define* (%remote-eval lowered session #:optional become-command)
@@ -106,7 +111,7 @@ result to the current output port using the (guix repl) protocol."
                       (build-locally? #t)
                       (system (%current-system))
                       (module-path %load-path)
-                      (socket-name "/var/guix/daemon-socket/socket")
+                      (socket-name (%daemon-socket-uri))
                       (become-command #f))
   "Evaluate EXP, a gexp, on the host at SESSION, an SSH session.  Ensure that
 all the elements EXP refers to are built and deployed to SESSION beforehand.