all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Christopher Baines <mail@cbaines.net>
To: 34638@debbugs.gnu.org
Subject: [bug#34638] [PATCH v2 1/4] utils: Add #:base-directory to call-with-temporary-directory.
Date: Fri, 19 Apr 2019 15:04:24 +0100	[thread overview]
Message-ID: <20190419140427.15183-1-mail@cbaines.net> (raw)
In-Reply-To: <875zt9go87.fsf@cbaines.net>

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.
---
 guix/utils.scm | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/guix/utils.scm b/guix/utils.scm
index ed1a418cca..abeb156f40 100644
--- a/guix/utils.scm
+++ b/guix/utils.scm
@@ -620,10 +620,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
-- 
2.21.0

  parent reply	other threads:[~2019-04-19 14:05 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-24 16:12 [bug#34638] [PATCH 0/4] Isolated inferiors Christopher Baines
2019-02-24 16:18 ` [bug#34638] [PATCH 1/4] utils: Add #:base-directory to call-with-temporary-directory Christopher Baines
2019-02-24 16:18   ` [bug#34638] [PATCH 2/4] linux-container: Add 'start-child-in-container' Christopher Baines
2019-03-14 18:17     ` Ludovic Courtès
2019-04-19 14:16       ` Christopher Baines
2019-02-24 16:18   ` [bug#34638] [PATCH 3/4] inferior: Add a shared-directory field to <inferior> Christopher Baines
2019-02-24 16:18   ` [bug#34638] [PATCH 4/4] inferior: Add 'open-inferior/container' Christopher Baines
2019-03-14 19:35 ` [bug#34638] [PATCH 0/4] Isolated inferiors Ludovic Courtès
2019-04-19 14:04 ` Christopher Baines [this message]
2019-04-19 14:04   ` [bug#34638] [PATCH v2 2/4] linux-container: Add 'start-child-in-container' Christopher Baines
2020-03-26  9:28     ` Ludovic Courtès
2020-03-28 11:26       ` Christopher Baines
2020-03-28 12:20         ` Ludovic Courtès
2019-04-19 14:04   ` [bug#34638] [PATCH v2 3/4] inferior: Add a shared-directory field to <inferior> Christopher Baines
2020-03-26  9:30     ` Ludovic Courtès
2019-04-19 14:04   ` [bug#34638] [PATCH v2 4/4] inferior: Add 'open-inferior/container' Christopher Baines
2020-03-26  9:32     ` Ludovic Courtès
2020-03-26  9:22   ` [bug#34638] [PATCH v2 1/4] utils: Add #:base-directory to call-with-temporary-directory Ludovic Courtès

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190419140427.15183-1-mail@cbaines.net \
    --to=mail@cbaines.net \
    --cc=34638@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.