SYS-0007: Add support for dup3 and pipe2 POSIX API to FileDescriptor is ready for review, and we would love your feedback! The review period will run through May 25.
I didn't select the Proposal Reviews topic since it's not an official Swift Evolution proposal, but Related Projects > System is probably a better place to host this moving forward.
Oh, it occurs to me that Windows' _pipe(), which takes a flags argument (named, confusingly, textmode), is basically the same as pipe2(), and we ought to consider supporting it. The set of flags it supports isn't the same as POSIX.
That is already what we call for the no-options version of FileDescriptor.pipe(). It's not clear to me what the guarantees of Windows's _pipe() happed to be regarding when options are set with regard to file descriptor binding. Are they similar enough to those of POSIX's pipe2?
We can amend this proposal later if we find that we can use the existing call for pipe2 on Windows.
As far as I can tell, we've always passed _O_NOINHERIT to Windows's _pipe() call, probably making it more similar in behaviour to a pipe2() with a default value of O_CLOEXEC. I'm not entirely sure how to square that with this proposal.
That seems like the wrong default (or rather, I would expect that we'd apply _O_NOINHERIT in the same contexts as O_CLOEXEC). There are some subtle differences between the flags and how you manage handle inheritance vs. file descriptor inheritance, but in broad strokes they represent the same concept.
The review period has concluded, thank you all for your feedback! Given the support, we accept this proposal and will work to land it in swift-system, adding a note for future directions of pipe2 on Windows.
As a reminder, future swift-system pitches and proposal reviews will be hosted in Related Projects > System. Thank you all!