Skip to content

Enable .closeOnExec for FileDescriptor.open on Windows#331

Open
jakepetroules wants to merge 1 commit into
mainfrom
windows-open-closeOnExec
Open

Enable .closeOnExec for FileDescriptor.open on Windows#331
jakepetroules wants to merge 1 commit into
mainfrom
windows-open-closeOnExec

Conversation

@jakepetroules

Copy link
Copy Markdown
Member

Make OpenOptions.closeOnExec available on Windows, where it maps to _O_CLOEXEC (O_NOINHERIT). The Windows open adapter already decodes O_NOINHERIT into a non-inheritable handle, so this produces the expected close-on-exec semantics. Also add the deprecated O_NOINHERIT alias, matching the PipeOptions treatment from #312.

Make OpenOptions.closeOnExec available on Windows, where it maps to
_O_CLOEXEC (O_NOINHERIT). The Windows open adapter already decodes
O_NOINHERIT into a non-inheritable handle, so this produces the
expected close-on-exec semantics. Also add the deprecated O_NOINHERIT
alias, matching the PipeOptions treatment from #312.
@jakepetroules

Copy link
Copy Markdown
Member Author

@swift-ci test

@@ -319,6 +318,11 @@ extension FileDescriptor {
@_alwaysEmitIntoClient
@available(*, unavailable, renamed: "closeOnExec")
public static var O_CLOEXEC: OpenOptions { closeOnExec }

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should probably still be !Windows here.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm just staying consistent with what PipeOptions is doing.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that's just a typo in PipeOptions that we didn't catch.

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 this pull request may close these issues.

2 participants