[Haskell-cafe] about openTempFile
manlio_perillo at libero.it
Wed Sep 17 08:17:30 EDT 2008
After reading the chapter about IO in the "Real Word Haskell" book, I
have noted that there is no support for opening a temporary file that
will be automatically removed at program termination.
The Python tempfile module, as an example, implements a wrapper around
mkstemp function that does exactly this, and the code is portable; on
Windows it uses O_TEMPORARY_FILE flag, on POSIX systems the file is
unlink-ed as soon as it is created (but note that the code is not signal
safe - well, many functions in the Python standard library are not
There are reasons why GHC library does not implement this?
The Python version also set the FD_CLOEXEC, O_NOINHERIT and O_NOFOLLOW
flags (where available).
The GHC version, instead, set the O_NOCTTY flag.
More information about the Haskell-Cafe