[Haskell-cafe] I/O system brokenness with named pipes

John Goerzen jgoerzen at complete.org
Thu Apr 10 21:34:41 EDT 2008


So I have a need to write data to a POSIX named pipe (aka FIFO).  Long
story involving a command that doesn't have an option to read data
from stdin, but can from a named pipe.

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)

which is completely false, as it *does* exist, and I can cat to it as
expected.  The call should block until everything is read on the
remote end.

I thought maybe writeFile is being weird, so I tried:

openFile "/tmp/bakroller.zD0xHj/fifo" WriteMode

Same thing.

There is no logical reason I can see for this behavior.  In fact,
something must be going to *extra* effort to avoid writing to a named
pipe, and I can't work out why.  Named pipes are a standard, useful
part of a system and shouldn't be ignored like this.

Interestingly, readFile works fine on a named pipe.

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?

-- John



More information about the Haskell-Cafe mailing list