diff options
Diffstat (limited to 'src/connection/shell-wrap.lisp')
-rw-r--r-- | src/connection/shell-wrap.lisp | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/src/connection/shell-wrap.lisp b/src/connection/shell-wrap.lisp index 51591b8..1200391 100644 --- a/src/connection/shell-wrap.lisp +++ b/src/connection/shell-wrap.lisp @@ -46,18 +46,16 @@ path content mode) - (let ((cmd - (format - nil "set -e -tmpf=$(~A) -trap \"rm -f '$tmpf'\" EXIT HUP KILL TERM INT -chmod ~O \"$tmpf\" -cat >\"$tmpf\" -mv \"$tmpf\" ~A" - (mkstemp-cmd - (merge-pathnames "tmp.XXXXXX" (pathname-directory-pathname path))) - mode - (sh-escape path)))) + (let* ((mkstemp (mkstemp-cmd + (merge-pathnames "tmp.XXXXXX" + (pathname-directory-pathname path)))) + (cmd (sh-script-to-single-line + (format nil "set -e + tmpf=$(~A) + trap \"rm -f '$tmpf'\" EXIT HUP KILL TERM INT + chmod ~O \"$tmpf\" + cat >\"$tmpf\" + mv \"$tmpf\" ~A" mkstemp mode (sh-escape path))))) (multiple-value-bind (out exit) (connection-run conn cmd content) (unless (zerop exit) (error "Failed to write ~A: ~A" path out))))) |