Hi.

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 signal safe).

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.



Manlio Perillo
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to