Bug with readFile and named pipes
Volker Stolz
stolz at hyperion.informatik.rwth-aachen.de
Wed Aug 22 07:50:06 EDT 2001
In local.glasgow-haskell-bugs, you wrote:
> Programs that read from a named pipe usually block until a writer opens
> the pipe and writes something to it. The following program,
>
> main = putStr =<< readFile "/tmp/p"
>
> (where "/tmp/p" refers to a named pipe) exhibits this behavour when
> compiled with HBC or when run with runhugs, but *not* when compiled with
> GHC. Instead the program immediately exists, returning the empty string.
I don't know if we`re talking about different things, but when I
played around with fifos (e.g. For TCP/Hugs :-), I noticed that it is
recommended to open the FIFO for *writing* *before* *opening* it for
*reading*, even if you`re not going to write to it yourself.
I wouldn`t want readFile opening my file for writing under normal cases,
so I'd recommend you use a hack which opens the file for writing first.
One could imagine that readFile tests the filetype and does
The Right Thing(TM), but I`m not sure I want that, either.
--
Neues aus Genua? http://germany.indymedia.org/
Volker Stolz * stolz at i2.informatik.rwth-aachen.de * PGP + S/MIME
More information about the Glasgow-haskell-bugs
mailing list