Browse Source

utils: Create temporary files in $TMPDIR or /tmp.

Reported by Federico Beffa <beffa@ieee.org>.

* guix/utils.scm (call-with-temporary-output-file): Prepend $TMPDIR or
  /tmp to TEMPLATE.
gn-latest-20200428
Ludovic Courtès 6 years ago
parent
commit
57db49cc3e
1 changed files with 3 additions and 2 deletions
  1. +3
    -2
      guix/utils.scm

+ 3
- 2
guix/utils.scm View File

@@ -600,8 +600,9 @@ REPLACEMENT."
"Call PROC with a name of a temporary file and open output port to that
file; close the file and delete it when leaving the dynamic extent of this
call."
(let* ((template (string-copy "guix-file.XXXXXX"))
(out (mkstemp! template)))
(let* ((directory (or (getenv "TMPDIR") "/tmp"))
(template (string-append directory "/guix-file.XXXXXX"))
(out (mkstemp! template)))
(dynamic-wind
(lambda ()
#t)


Loading…
Cancel
Save