diff options
author | Sean Whitton <spwhitton@spwhitton.name> | 2021-02-23 17:41:07 -0700 |
---|---|---|
committer | Sean Whitton <spwhitton@spwhitton.name> | 2021-02-23 17:41:07 -0700 |
commit | 76302017940f60286867dc083def308d3115e1e7 (patch) | |
tree | a239e60c7d868f4f7caebcbc1c9efc6a7385d995 | |
parent | ccb72f945a35429182a3bc8d43ed5426999f81c7 (diff) | |
download | consfigurator-76302017940f60286867dc083def308d3115e1e7.tar.gz |
use MRUN in various places in the connection type definitions
Signed-off-by: Sean Whitton <spwhitton@spwhitton.name>
-rw-r--r-- | src/connection/debian-sbcl.lisp | 2 | ||||
-rw-r--r-- | src/connection/ssh.lisp | 17 |
2 files changed, 8 insertions, 11 deletions
diff --git a/src/connection/debian-sbcl.lisp b/src/connection/debian-sbcl.lisp index 56c4d8e..cdb69df 100644 --- a/src/connection/debian-sbcl.lisp +++ b/src/connection/debian-sbcl.lisp @@ -18,7 +18,7 @@ (in-package :consfigurator.connection.debian-sbcl) (defmethod establish-connection ((type (eql :debian-sbcl)) remaining &key) - (run "which sbcl >/dev/null 2>&1 || apt-get -y install sbcl") + (mrun "which sbcl >/dev/null 2>&1 || apt-get -y install sbcl") (request-lisp-systems) (upload-all-prerequisite-data) (princ "Handing over to remote Lisp ...") diff --git a/src/connection/ssh.lisp b/src/connection/ssh.lisp index c6acfee..2962fbc 100644 --- a/src/connection/ssh.lisp +++ b/src/connection/ssh.lisp @@ -24,7 +24,7 @@ (hop (get-hostname)) user) (declare (ignore remaining)) - (run "ssh" "-fN" hop) + (mrun "ssh" "-fN" hop) (make-instance 'ssh-connection :hostname hop :user user)) (defclass ssh-connection (posix-connection) @@ -51,25 +51,22 @@ (if (cdr args) (escape-sh-command args) (car args))))))) (defmethod connection-run ((c ssh-connection) cmd &optional input) - (multiple-value-bind (out err exit) - (run :may-fail :input input (sshcmd c cmd)) - (values (strcat err out) exit))) + (mrun :may-fail :input input (sshcmd c cmd))) (defmethod connection-readfile ((c ssh-connection) path) - (multiple-value-bind (out err exit-code) - (run :may-fail + (multiple-value-bind (out exit-code) + (mrun :may-fail (sshcmd c (format nil "test -r ~A && cat ~:*~A" (escape-sh-token path)))) - (declare (ignore err)) (if (= 0 exit-code) out (error "File ~S not readable" path)))) (defmethod connection-writefile ((c ssh-connection) path contents) (with-remote-temporary-file (temp) - (run :input contents (sshcmd c "cat" #?">$(temp)")) - (run "mv" temp path))) + (mrun :input contents (sshcmd c "cat" #?">$(temp)")) + (mrun "mv" temp path))) ;; rsync it straight to to its destination so rsync can do incremental updates (defmethod connection-upload ((c ssh-connection) from to) - (run "rsync" "-Pavc" from (format nil "~A:~A" (ssh-host c) to))) + (mrun "rsync" "-Pavc" from (format nil "~A:~A" (ssh-host c) to))) |