mirror of
https://github.com/apple/swift-system
synced 2026-11-24 04:38:14 +00:00
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