Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Should O_CLOEXEC be set on POSIX? #21

Closed
Tracked by #179
Rufflewind opened this issue May 20, 2024 · 7 comments · Fixed by #23
Closed
Tracked by #179

Should O_CLOEXEC be set on POSIX? #21

Rufflewind opened this issue May 20, 2024 · 7 comments · Fixed by #23

Comments

@Rufflewind
Copy link
Member

Rufflewind commented May 20, 2024

Another diff observed while trying to migrate directory to file-io (#4 (comment)):

Should files opened by file-io set O_CLOEXEC to prevent them from being inherited by child processes?

@hasufell
Copy link
Member

I think we discussed this already in #5 and the verdict was that this library tries to stay as close to base behavior as possible.

You can use setCloseOnExec explicitly.

@Rufflewind
Copy link
Member Author

You can use setCloseOnExec explicitly.

It isn't thread-safe since another thread can fork the executable between open and setCloseOnExec.

@hasufell
Copy link
Member

We can provide a variant openFileWithCloseOnExec, possibly through a .Internal module.

Internal modules still follow PVP, but may not have deprecation periods.

@Rufflewind
Copy link
Member Author

Sounds good.

@hasufell
Copy link
Member

@Rufflewind
Copy link
Member Author

@hasufell
Copy link
Member

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants