diff --git a/ordo/action/remote-cmd.scm b/ordo/action/remote-cmd.scm
index dbb14a5..4f2475f 100644
--- a/ordo/action/remote-cmd.scm
+++ b/ordo/action/remote-cmd.scm
@@ -1,27 +1,29 @@
(define-module (ordo action remote-cmd)
#:use-module (ice-9 exceptions)
+ #:use-module (ice-9 optargs)
#:use-module (srfi srfi-1)
#:use-module (srfi srfi-71)
#:use-module (ordo connection)
#:use-module (ordo connection base)
#:use-module (ordo logger)
#:use-module (ordo util flatten)
- #:use-module (ordo util keyword-args)
#:export (remote-cmd))
(define (remote-cmd conn prog . args)
- (let* ((args options (break keyword? args))
- (args (remove unspecified? (flatten args)))
- (return (keyword-arg options #:return identity))
- (check? (keyword-arg options #:check?))
- (command (build-command conn prog args options)))
- (log-msg 'DEBUG "Running command: " command " on connection " (describe conn))
- (let ((out rc (remote-exec conn command)))
- (log-msg 'DEBUG "Command exit code: " rc)
- (if check?
- (if (zero? rc)
- (return out)
- (raise-exception (make-exception
- (make-external-error)
- (make-exception-with-message (format #f "Non-zero exit (~a) from ~a" rc prog)))))
- (values (return out) rc)))))
+ (let ((args options (break keyword? args)))
+ (let-keywords
+ options #t
+ ((return identity)
+ (check? #f))
+ (let ((command (build-command conn prog (remove unspecified? (flatten args)) options)))
+ (log-msg 'DEBUG "Running command: " command " on connection " (describe conn))
+ (let ((out rc (remote-exec conn command)))
+ (log-msg 'DEBUG "Command exit code: " rc)
+ (if check?
+ (if (zero? rc)
+ (return out)
+ (raise-exception (make-exception
+ (make-external-error)
+ (make-exception-with-message (format #f "Non-zero exit (~a) from ~a" rc prog))
+ (make-exception-with-irritants out))))
+ (values (return out) rc)))))))
diff --git a/ordo/connection/base.scm b/ordo/connection/base.scm
index 330c8f9..0f9a017 100644
--- a/ordo/connection/base.scm
+++ b/ordo/connection/base.scm
@@ -17,9 +17,9 @@ this program. If not, see .
(define-module (ordo connection base)
#:use-module (ice-9 match)
+ #:use-module (ice-9 optargs)
#:use-module (oop goops)
#:use-module (ordo util flatten)
- #:use-module (ordo util keyword-args)
#:use-module (ordo util shell-quote)
#:use-module ((srfi srfi-1) #:select (remove))
#:export (
@@ -46,14 +46,17 @@ this program. If not, see .
(define-method (teardown (c )) #t)
(define-method (build-command (c ) (prog-name ) (prog-args ) (options ))
- (let* ((pwd (keyword-arg options #:pwd))
- (env (keyword-arg options #:env))
- (redirect-err? (keyword-arg options #:redirect-err? #t))
- (xs (remove unspecified?
+ (let-keywords
+ options #t
+ ((pwd #f)
+ (env #f)
+ (shell-quote? #t)
+ (redirect-err? #t))
+ (let ((xs (remove unspecified?
(flatten (list "env"
(when pwd (list "--chdir" (string-shell-quote pwd)))
(when env (map (match-lambda ((k . v) (string-append k "=" (string-shell-quote v)))) env))
prog-name
- (map string-shell-quote prog-args)
+ (if shell-quote? (map string-shell-quote prog-args) prog-args)
(when redirect-err? "2>&1"))))))
- (string-join xs " ")))
+ (string-join xs " "))))
diff --git a/ordo/core.scm b/ordo/core.scm
index 6e65ff9..e2026d4 100644
--- a/ordo/core.scm
+++ b/ordo/core.scm
@@ -76,7 +76,8 @@ this program. If not, see .
(log-msg 'NOTICE (task-name task) " - CHANGED")
(for-each schedule-handler! (task-trigger task)))
(else
- (log-msg 'NOTICE (task-name task) " - " result))))
+ (log-msg 'NOTICE (task-name task) " - " result)))
+ result)
(log-msg 'NOTICE (task-name task) " - SKIPPED")))
(define-method (execute% (task ) (host ) (options ))
@@ -154,6 +155,7 @@ may also be called outside of a blueprint (e.g. when a stand-alone task is run),
in which case it is a no-op."
(let ((triggered (*triggered-handlers*)))
(when triggered
+ (log-msg 'DEBUG "Scheduling handler: " handler-name)
(hash-table-set! triggered handler-name #t))))
(define-method (execute% (blueprint ) (conn ))
diff --git a/ordo/util/keyword-args.scm b/ordo/util/keyword-args.scm
deleted file mode 100644
index 95de5eb..0000000
--- a/ordo/util/keyword-args.scm
+++ /dev/null
@@ -1,23 +0,0 @@
-#|
-This file is part of Ordo.
-
-Copyright (C) 2025 Ray Miller
-
-This program is free software: you can redistribute it and/or modify it under
-the terms of the GNU General Public License as published by the Free Software
-Foundation, version 3.
-
-This program is distributed in the hope that it will be useful, but WITHOUT ANY
-WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
-PARTICULAR PURPOSE. See the GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License along with
-this program. If not, see .
-|#
-
-(define-module (ordo util keyword-args)
- #:use-module ((srfi srfi-1) #:select (member))
- #:export (keyword-arg))
-
-(define* (keyword-arg args kw #:optional (default #f))
- (or (and=> (member kw args) cadr) default))