aboutsummaryrefslogtreecommitdiff
path: root/src/connection/ssh.lisp
diff options
context:
space:
mode:
authorSean Whitton <spwhitton@spwhitton.name>2021-02-22 14:30:04 -0700
committerSean Whitton <spwhitton@spwhitton.name>2021-02-22 14:30:04 -0700
commit3d83bfef73f4faa7e674dd2601fc0731f6b279a3 (patch)
treed7b0c2662cff48ca308452ef3c849c19a60adb9b /src/connection/ssh.lisp
parent2cafe2e1273f41801471edfd3d0a4da523846421 (diff)
downloadconsfigurator-3d83bfef73f4faa7e674dd2601fc0731f6b279a3.tar.gz
fix :SSH CONNECTION-READFILE
Signed-off-by: Sean Whitton <spwhitton@spwhitton.name>
Diffstat (limited to 'src/connection/ssh.lisp')
-rw-r--r--src/connection/ssh.lisp11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/connection/ssh.lisp b/src/connection/ssh.lisp
index be5afa6..faa16a9 100644
--- a/src/connection/ssh.lisp
+++ b/src/connection/ssh.lisp
@@ -56,10 +56,13 @@
(values (strcat err out) exit)))
(defmethod connection-readfile ((c ssh-connection) path)
- (multiple-value-bind (output error-code)
- (run (sshcmd c "test" "-r" path "&&" "cat" path))
- (if (= 0 error-code)
- output
+ (multiple-value-bind (out err exit-code)
+ (run :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)