Switch back to records, not goops

This commit is contained in:
Ray Miller 2025-01-12 15:28:29 +00:00
parent 70543ef7c5
commit 5376ce9f19
Signed by: ray
GPG key ID: 043F786C4CD681B8
3 changed files with 117 additions and 140 deletions

View file

@ -80,15 +80,16 @@
(loop (read-line port) '()))
(define-method (build-command (c <connection>) pwd env prog args)
(let ((cmd (list (if (sudo? c) "sudo" "env"))))
(chain-when cmd
(pwd (append _ (list "--chdir" pwd)))
(env (append _ (map (lambda (x) (string-append (car x) "=" (string-shell-quote (cdr x)))) env)))
(#t (append _
(list prog)
(map string-shell-quote args)
(list "2>&1")))
(#t (string-join _ " ")))))
(let ((cmd (chain-when (list (if (sudo? c) "sudo" "env"))
(pwd (append _ (list "--chdir" pwd)))
(env (append _ (map (lambda (x) (string-append (car x) "=" (string-shell-quote (cdr x)))) env)))
(#t (append _
(list prog)
(map string-shell-quote args)
(list "2>&1")))
(#t (string-join _ " ")))))
(log-msg 'INFO "Running command: " cmd)
cmd))
(define-method (connection-run (c <local-connection>) pwd env prog args)
(let* ((cmd (build-command c pwd env prog args))
@ -127,7 +128,7 @@
(cond
((< (length args) 2) default)
((equal? (first args) kw) (second args))
(else (keyword-arg kw (cddr args)))))
(else (keyword-arg kw (cddr args) default))))
(define (run conn prog . args)
(let* ((args (flatten args))