From afe955cbd1dab48cf15a5a9b3f033d47d87720f4 Mon Sep 17 00:00:00 2001 From: Sean Whitton Date: Sat, 25 Jun 2022 15:12:14 -0700 Subject: convert some internal shell snippets to single lines Signed-off-by: Sean Whitton --- src/connection/shell-wrap.lisp | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) (limited to 'src/connection') 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))))) -- cgit v1.2.3