aboutsummaryrefslogtreecommitdiff
path: root/src/connection.lisp
diff options
context:
space:
mode:
authorSean Whitton <spwhitton@spwhitton.name>2021-04-08 13:16:14 -0700
committerSean Whitton <spwhitton@spwhitton.name>2021-04-08 13:16:14 -0700
commit0fc7adbc77760f24cd8a32d4b01587959e481c46 (patch)
treebadd2a30e4a8a920813a9993e10ae7aa713334df /src/connection.lisp
parentd3185fda78ecf915ce7ea3ae8d60441f3c89af1b (diff)
downloadconsfigurator-0fc7adbc77760f24cd8a32d4b01587959e481c46.tar.gz
reindent
Signed-off-by: Sean Whitton <spwhitton@spwhitton.name>
Diffstat (limited to 'src/connection.lisp')
-rw-r--r--src/connection.lisp66
1 files changed, 33 insertions, 33 deletions
diff --git a/src/connection.lisp b/src/connection.lisp
index 605667d..2b03e44 100644
--- a/src/connection.lisp
+++ b/src/connection.lisp
@@ -272,39 +272,39 @@ the working directory of the Lisp process using UIOP:WITH-CURRENT-DIRECTORY."
(defmacro %process-run-args (&body forms)
`(let (cmd input may-fail for-exit env inform)
- (loop for arg = (pop args)
- do (case arg
- (:for-exit (setq may-fail t for-exit t))
- (:may-fail (setq may-fail t))
- (:inform (setq inform t))
- (:input (setq input (pop args)))
- (:env (setq env (pop args)))
- (t (mapc (lambda (e)
- (push (typecase e
- (pathname
- (unix-namestring e))
- (t
- e))
- cmd))
- (ensure-list arg))))
- while args
- finally (nreversef cmd))
- (setq cmd (if (cdr cmd) (escape-sh-command cmd) (car cmd)))
- (loop while env
- collect (format nil "~A=~A"
- (symbol-name (pop env)) (escape-sh-token (pop env)))
- into accum
- finally
- (when accum
- ;; We take this approach of exporting individual variables
- ;; rather than just prepending `FOO=bar BAR=baz` so that if CMD
- ;; contains $FOO it will get expanded. We used to use env(1)
- ;; but that means CMD cannot contain shell builtins which do
- ;; not have an equivalent on PATH, such as 'cd'. This approach
- ;; does mean that implementations of CONNECTION-RUN will need
- ;; to start a fresh 'sh -c' for each command run, but that's
- ;; desirable to ensure any variables set by CMD are reset.
- (setq cmd (format nil "~{export ~A;~^ ~} ~A" accum cmd))))
+ (loop for arg = (pop args)
+ do (case arg
+ (:for-exit (setq may-fail t for-exit t))
+ (:may-fail (setq may-fail t))
+ (:inform (setq inform t))
+ (:input (setq input (pop args)))
+ (:env (setq env (pop args)))
+ (t (mapc (lambda (e)
+ (push (typecase e
+ (pathname
+ (unix-namestring e))
+ (t
+ e))
+ cmd))
+ (ensure-list arg))))
+ while args
+ finally (nreversef cmd))
+ (setq cmd (if (cdr cmd) (escape-sh-command cmd) (car cmd)))
+ (loop while env
+ collect (format nil "~A=~A"
+ (symbol-name (pop env)) (escape-sh-token (pop env)))
+ into accum
+ finally
+ (when accum
+ ;; We take this approach of exporting individual variables
+ ;; rather than just prepending `FOO=bar BAR=baz` so that if CMD
+ ;; contains $FOO it will get expanded. We used to use env(1)
+ ;; but that means CMD cannot contain shell builtins which do
+ ;; not have an equivalent on PATH, such as 'cd'. This approach
+ ;; does mean that implementations of CONNECTION-RUN will need
+ ;; to start a fresh 'sh -c' for each command run, but that's
+ ;; desirable to ensure any variables set by CMD are reset.
+ (setq cmd (format nil "~{export ~A;~^ ~} ~A" accum cmd))))
(setq cmd (format nil "cd ~A; ~A"
(escape-sh-token (unix-namestring (pwd))) cmd))
,@forms))