aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Baines <mail@cbaines.net>2019-02-24 13:14:09 +0000
committerChristopher Baines <mail@cbaines.net>2020-03-28 09:35:58 +0000
commitf27490e2d33d2b191f51fba59ea7bc0d5a99d037 (patch)
tree64960780b9d5662d0f76af4d8d173649935553e9
parent24b5d8f745d383c427a729c930a1ae0c0901c360 (diff)
downloadguix-f27490e2d33d2b191f51fba59ea7bc0d5a99d037.tar
guix-f27490e2d33d2b191f51fba59ea7bc0d5a99d037.tar.gz
utils: Add #:base-directory to call-with-temporary-directory.
This allows more easily creating temporary directories within a specific directory. This is motivated by using this in inferior-eval-with-store. * guix/utils.scm (call-with-temporary-directory): Add optional keyword argument, base-directory.
-rw-r--r--guix/utils.scm4
1 files changed, 2 insertions, 2 deletions
diff --git a/guix/utils.scm b/guix/utils.scm
index 3e8e59b8dc..0d393745c6 100644
--- a/guix/utils.scm
+++ b/guix/utils.scm
@@ -649,10 +649,10 @@ call."
(false-if-exception (close out))
(false-if-exception (delete-file template))))))
-(define (call-with-temporary-directory proc)
+(define* (call-with-temporary-directory proc #:key base-directory)
"Call PROC with a name of a temporary directory; close the directory and
delete it when leaving the dynamic extent of this call."
- (let* ((directory (or (getenv "TMPDIR") "/tmp"))
+ (let* ((directory (or base-directory (getenv "TMPDIR") "/tmp"))
(template (string-append directory "/guix-directory.XXXXXX"))
(tmp-dir (mkdtemp! template)))
(dynamic-wind