Skip to content

Conversation

glessard
Copy link
Contributor

No description provided.

jrflat and others added 4 commits August 3, 2025 11:24
…riptor on Windows

FileDescriptor.duplicate(as:) is backed by dup2 on Unix, and _dup2 on Windows.
On Unix, dup2 returns its second argument. On Windows, _dup2 instead returns
0 on success and -1 on error. This results in the newly returned FileDescriptor
object always containing a '0' file descriptor rather than the newly created
file descriptor, in violation of the documented behavior.

Account for the platform difference in the syscall wrapper to fix this.

Closes #192

(cherry picked from commit b2711a8)
[1.6] Fix: FileDescriptor.duplicate(as:) returns an invalid file descriptor on Windows
@glessard
Copy link
Contributor Author

@swift-ci please test

@glessard glessard merged commit 4bbe3f3 into main Sep 18, 2025
111 of 112 checks passed
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.

3 participants