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:
parent
0550ab5b60
commit
2e03da3e01
2 changed files with 6 additions and 15 deletions
|
@ -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!))
|
||||
|
||||
|
|
|
@ -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)))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue