Get rid of scratch-dir from context

Leave it to the actions to deal with their own temporary file clean-up.
This commit is contained in:
Ray Miller 2025-01-10 16:03:45 +00:00
parent 0550ab5b60
commit 2e03da3e01
Signed by: ray
GPG key ID: 043F786C4CD681B8
2 changed files with 6 additions and 15 deletions

View file

@ -7,8 +7,6 @@
#:export (make-context
context?
context-connection
context-scratch-dir
set-context-scratch-dir!
add-context-triggers!
get-context-triggers
context-triggered?
@ -22,7 +20,6 @@
(make-context connection vars)
context?
(connection context-connection)
(scratch-dir context-scratch-dir set-context-scratch-dir!)
(vars context-vars set-context-vars!)
(triggers context-triggers set-context-triggers!))

View file

@ -62,16 +62,10 @@
(play-connection play)
(lambda (c)
(let* ((ctx (make-context c (play-vars play))))
(set-context-scratch-dir! ctx (first (must ctx "mktemp" '("--directory"))))
(dynamic-wind
(const #t)
(lambda ()
(for-each (cut run-task ctx <>) (play-tasks play))
(for-each (match-lambda
((name . handler)
(when (context-triggered? ctx name)
(run-handler ctx handler))))
(play-handlers play)))
(lambda ()
(must ctx "rm" `("-rf" ,(context-scratch-dir ctx))))))))
(for-each (cut run-task ctx <>) (play-tasks play))
(for-each (match-lambda
((name . handler)
(when (context-triggered? ctx name)
(run-handler ctx handler))))
(play-handlers play)))))
(format #t "COMPLETED PLAY ~a~%" (play-description play)))