From b463a828bebccf115d25a94f84b77ab8565dd066 Mon Sep 17 00:00:00 2001 From: Ray Miller Date: Mon, 6 Jan 2025 21:38:32 +0000 Subject: [PATCH] Fix task action handling Refactor actions to remove context --- modules/ordo/action/filesystem.scm | 3 +-- modules/ordo/task.scm | 11 ++++++----- tryme.scm | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/modules/ordo/action/filesystem.scm b/modules/ordo/action/filesystem.scm index 2ed5548..bc10cc6 100644 --- a/modules/ordo/action/filesystem.scm +++ b/modules/ordo/action/filesystem.scm @@ -5,7 +5,6 @@ #:use-module (srfi srfi-71) ; extended let #:use-module ((srfi srfi-197) #:select (chain-when)) #:use-module (ordo connection) - #:use-module (ordo context) #:export (create-temporary-directory install-directory install-file)) @@ -30,7 +29,7 @@ ;; Helper not intended for use outside of this module (define (upload-tmp-file conn) (lambda (input-port) - (let ((tmp-path (car (connection-must conn "mktemp")))) + (let ((tmp-path (car (connection-must conn "mktemp" '())))) (connection-call-with-output-file conn tmp-path (lambda (output-port) (let loop ((data (get-bytevector-some input-port))) diff --git a/modules/ordo/task.scm b/modules/ordo/task.scm index 1c97fa2..ee1b100 100644 --- a/modules/ordo/task.scm +++ b/modules/ordo/task.scm @@ -28,15 +28,16 @@ ((_ description (action arg ...) kwarg ...) (task% description - (lambda (conn ctx) - (action conn (resolve-context-refs ctx arg) ...)) + (lambda (ctx) + (action (resolve-context-refs ctx arg) ...)) kwarg ...)))) -(define (run-task conn ctx task) - (match task +(define (run-task conn ctx t) + (match t (($ description action register triggers) (format #t "RUNNING TASK ~a~%" description) - (let ((result (action conn ctx))) + (pk 'action action) + (let ((result ((action ctx) conn))) (when register (register-context-var! ctx register result)) (when triggers diff --git a/tryme.scm b/tryme.scm index 8185bd7..316bcf7 100644 --- a/tryme.scm +++ b/tryme.scm @@ -38,4 +38,4 @@ (fritz . ,(handler "Fritz" (const #t))) (frotz . ,(handler "Frotz" (const #t)))))) -;;(run-play test-play) +(run-play test-play)