Open cyangle opened 11 months ago
Portability is an important concern for stdlib APIs.
Can we implement an API that works on other OSes than Linux?
BSD's mkfifo
looks pretty similar. Windows' named pipes are quite a bit different, though.
Maybe this would be better fitting for a platform-specific shard? (which is yet to be created, but the idea has been floating around for a long time).
Windows named pipes are volatile, removed after the last reference to them is closed. ref
So it's almost impossible to implement it in windows. I think that's why it's only available as syscall in golang.
Linux FIFOs do exist under WSL and can be exposed to the Windows side as reparse points with the IO_REPARSE_TAG_LX_FIFO
tag. However, unlike Unix sockets, I don't think there is any FIFO interop on the Windows side, so they are as good as unsupported.
Post-1.0 I don't think the standard library will introduce any new platform-specific concepts if either the POSIX or Windows implementation is guaranteed to be made up of NotImplementedError
s. (This is why System::Group
is such a headache, because Windows groups and POSIX groups are fundamentally different, and the latter got in before 1.0.)
Feature Request
It should be possible to create a fifo file in Unix environments from crystal code directly.
It's surprising to see that you need to create fifo file with a shell command here.
mkfifo
is available on Ruby and Python std lib: Python mkfifo, only available on Unix platforms. Ruby mkfifoIt seems to be trivial to implement File#mkfifo as shown in https://github.com/crystal-lang/crystal/pull/14004