summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArun Isaac2022-07-20 20:25:24 +0530
committerArun Isaac2022-07-20 20:25:24 +0530
commit4f0b19600ae55b29ce0f515d2e1603172b73f3c4 (patch)
treead5810944c5c6147d70224704b66d7ab8695f7f8
parentbe74b4432a8e187e21c03d71eaa07a6855519247 (diff)
downloadtissue-4f0b19600ae55b29ce0f515d2e1603172b73f3c4.tar.gz
tissue-4f0b19600ae55b29ce0f515d2e1603172b73f3c4.tar.lz
tissue-4f0b19600ae55b29ce0f515d2e1603172b73f3c4.zip
utils: Allow specifying parent of temporary directory.
* tissue/utils.scm (call-with-temporary-directory): Allow specifying directory in which to create temporary directory.
-rw-r--r--tissue/utils.scm8
1 files changed, 4 insertions, 4 deletions
diff --git a/tissue/utils.scm b/tissue/utils.scm
index 84bafa5..59c0b0a 100644
--- a/tissue/utils.scm
+++ b/tissue/utils.scm
@@ -81,10 +81,10 @@ directory after THUNK returns."
thunk
(cut chdir original-current-directory))))
-(define (call-with-temporary-directory proc)
- "Call PROC with a new temporary directory, and delete it when PROC
-returns or exits non-locally."
- (let ((temporary-directory (mkdtemp "XXXXXX")))
+(define* (call-with-temporary-directory proc #:optional (parent-directory (getcwd)))
+ "Call PROC with a new temporary directory in PARENT-DIRECTORY, and
+delete it when PROC returns or exits non-locally."
+ (let ((temporary-directory (mkdtemp (string-append parent-directory "/XXXXXX"))))
(dynamic-wind (const #t)
(cut proc temporary-directory)
(lambda ()