[Haskell-beginners] Named Pipes Et Cetera
mac01021 at engr.uconn.edu
Tue Nov 23 09:13:54 EST 2010
That's interesting. This was using my source code?
On mine (also a Linux box), it exited immediately, giving me no
opportunity to write to the pipe.
On 2010-11-23, Patrick LeBoutillier <patrick.leboutillier at gmail.com> wrote:
> Does it return immediately when you start it or only when you try to
> write to the pipe with some client?
> Here's what I get on my Linux box:
> $ rm /tmp/dld.fifo && ./pipe &
>  8603
> $ echo -e "1\n2\n3" > /tmp/dld.fifo
> pipe: /tmp/dld.fifo: hGetLine: end of file
> On Tue, Nov 23, 2010 at 7:55 AM, matthew coolbeth
> <mac01021 at engr.uconn.edu> wrote:
>> Hello, all.
>> Three questions:
>> 1> What, if anything, can I do in a Haskell program to do blocking
>> reads from a Linux FIFO? For the curious, there is a small program
>> below that doesn't block, but immediately terminates because of an EOF
>> 2> How could I have found the answer to this question on my own? (The
>> documentation that Google found for me was not completely adequate)
>> 3> Is this sort of question generally regarded as too unixy or not
>> haskelly enough to be appropriate for this mailing list?
>> --BEGIN PROGRAM--
>> module Main () where
>> import Control.Monad
>> import System.IO
>> import System.Posix.Files
>> pipeString = "/tmp/dld.fifo"
>> main :: IO ()
>> main = do
>> createNamedPipe pipeString $ unionFileModes ownerReadMode
>> pipe <- openFile pipeString ReadMode
>> forever (hGetLine pipe >>= putStrLn)
>> Beginners mailing list
>> Beginners at haskell.org
> Patrick LeBoutillier
> Rosemère, Québec, Canada
More information about the Beginners