Search code examples
haskellfile-descriptorunix-socket

Passing a file descriptor to another process in Haskell


I've read that you can pass a file descriptor to another process there, which seems perfect for what I want. Any chance that's do-able in Haskell in any way ? To be clear, I'm not forking and I can't pre-open the file, I actually need a way to pass a file descriptor (mainly stdin) from a bunch of processes to a daemon, to avoid having to keep processes up just to forward their input, that'd fill the process list quite fast and would probably eat ressources for no reason.

Thanks !


Solution

  • You can get the file descriptor of STDIN from the unix package and UNIX-domain sockets from network.

    I've never tried passing a file descriptor between processes, but it should work the same in Haskell as any other language.