[Haskell-cafe] I/O system brokenness with named pipes
duncan.coutts at worc.ox.ac.uk
Fri Apr 11 06:39:54 EDT 2008
On Thu, 2008-04-10 at 20:34 -0500, John Goerzen wrote:
> I have created the named pipe from Haskell no problem.
> But I can't use writeFile to write data to it. Worse, it returns:
> *** Exception: /tmp/bakroller.zD0xHj/fifo: openFile: does not exist
> (No such device or address)
> What's going on here? Am I going to have to resort to the
> System.Posix interface just to be able to write to a named pipe?
Named pipes have broken semantics for non-blocking IO, see google or the
man pages on named pipes. GHC's standard Handle IO always sets file
descriptor to non-blocking mode. That's the problem. That's why cat
works, because it uses blocking IO.
You would indeed need to use System.Posix to get a FD in blocking mode.
Then you have to worry a bit about blocking other Haskell thread when
you block on writing to the pipe.
More information about the Haskell-Cafe