remote, ssh: Show the command exit status upon failure.
* guix/remote.scm (remote-pipe-for-gexp): Show the exit status in error message. * guix/ssh.scm (remote-inferior): Likewise.
This commit is contained in:
parent
2a5f781e76
commit
e09c7f4ae4
@ -27,6 +27,7 @@
|
|||||||
#:use-module (guix derivations)
|
#:use-module (guix derivations)
|
||||||
#:use-module (guix utils)
|
#:use-module (guix utils)
|
||||||
#:use-module (ssh popen)
|
#:use-module (ssh popen)
|
||||||
|
#:use-module (ssh channel)
|
||||||
#:use-module (srfi srfi-1)
|
#:use-module (srfi srfi-1)
|
||||||
#:use-module (srfi srfi-34)
|
#:use-module (srfi srfi-34)
|
||||||
#:use-module (srfi srfi-35)
|
#:use-module (srfi srfi-35)
|
||||||
@ -68,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)))
|
(let ((pipe (apply open-remote-pipe* session OPEN_READ repl-command)))
|
||||||
(when (eof-object? (peek-char pipe))
|
(when (eof-object? (peek-char pipe))
|
||||||
(raise (condition
|
(let ((status (channel-get-exit-status pipe)))
|
||||||
(&message
|
(close-port pipe)
|
||||||
(message (format #f (G_ "failed to run '~{~a~^ ~}'")
|
(raise (condition
|
||||||
repl-command))))))
|
(&message
|
||||||
|
(message (format #f (G_ "remote command '~{~a~^ ~}' failed \
|
||||||
|
with status ~a")
|
||||||
|
repl-command status)))))))
|
||||||
pipe))
|
pipe))
|
||||||
|
|
||||||
(define* (%remote-eval lowered session #:optional become-command)
|
(define* (%remote-eval lowered session #:optional become-command)
|
||||||
|
14
guix/ssh.scm
14
guix/ssh.scm
@ -106,14 +106,14 @@ given, use that to invoke the remote Guile REPL."
|
|||||||
(let* ((repl-command (append (or become-command '())
|
(let* ((repl-command (append (or become-command '())
|
||||||
'("guix" "repl" "-t" "machine")))
|
'("guix" "repl" "-t" "machine")))
|
||||||
(pipe (apply open-remote-pipe* session OPEN_BOTH repl-command)))
|
(pipe (apply open-remote-pipe* session OPEN_BOTH repl-command)))
|
||||||
;; XXX: 'channel-get-exit-status' would be better here, but hangs if the
|
|
||||||
;; process does succeed. This doesn't reflect the documentation, so it's
|
|
||||||
;; possible that it's a bug in guile-ssh.
|
|
||||||
(when (eof-object? (peek-char pipe))
|
(when (eof-object? (peek-char pipe))
|
||||||
(raise (condition
|
(let ((status (channel-get-exit-status pipe)))
|
||||||
(&message
|
(close-port pipe)
|
||||||
(message (format #f (G_ "failed to run '~{~a~^ ~}'")
|
(raise (condition
|
||||||
repl-command))))))
|
(&message
|
||||||
|
(message (format #f (G_ "remote command '~{~a~^ ~}' failed \
|
||||||
|
with status ~a")
|
||||||
|
repl-command status)))))))
|
||||||
(port->inferior pipe)))
|
(port->inferior pipe)))
|
||||||
|
|
||||||
(define* (inferior-remote-eval exp session #:optional become-command)
|
(define* (inferior-remote-eval exp session #:optional become-command)
|
||||||
|
Loading…
Reference in New Issue
Block a user