Skip to content

provide WithCloseOnExec varients of rest of file opening functions #44

@joeyh

Description

@joeyh

#21 added openFileWithCloseOnExec and openExistingFileWithCloseOnExec to the Internal module, but the following other functions in file-io do not support setting the close on exec flag at open time:

openBinaryFile
withFile
withBinaryFile
readFile
writeFile
appendFile
openTempFile
openBinaryTempFile

I could use every single one of these if they existed, since I want to avoid all possible file descriptor leaks in my program.

I do understand that file-io is only aiming to replicate base behavior, and so it may seem that you have embarked on a slippery slope with #21. If you feel that is the case, maybe it would make sense to have a file-io-closeonexec? In that case, it would make sense to at least provide something in the file-io Internal module that can be used to make an openTempFile that sets CloseOnExec, to avoid quite a lot of complicated code duplication. The rest can be implemented easily enough externally to file-io using withOpenFile'.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions