Open jakepetroules opened 2 months ago
The current state of FileDescriptor
on Windows is that it's become a questionable POSIX-emulation layer, and it shouldn't be this way. We should have the thinnest possible wrappers over the platform calls, with the translation limited to adapting language differences. Cross-platform behaviour should be implemented by swift-foundation.
On Windows, _dup2 is documented to return 0 to indicate success, in contrast to POSIX's dup2, which returns the new file descriptor.
Should we change the Windows syscall adapter to something like:
I understand the general spirit of swift-system is to match the platform behavior, but this one stands out as potentially quite surprising, so I wonder if we should at least call it out in the documentation comments for this function?