tempfile
tempfile copied to clipboard
Restore default permissions on persist (on Unix)
Like #2 and #3, it would be nice to get a normal file after calling persist
on a NamedTemporaryFile
. NamedTemporaryFile
is opened with 0o600
, I'd expect to get a 0o644
file after that.
I'd probably use libc::umask
to determine the correct permissions but that sounds like a good idea.
Actually, this is a bit tricky. What if the user changes the file mode while it's a temporary file?
The same could be said for the attributes in #2 or #3.
Hmm. Maybe add a function that tells tempfile
to not mess with the file when persisting?
It's now possible to configure the permissions when creating a temporary file.
Thank you very much @Byron and @Stebalien! This fixes a long-standing problem I had. :)