Skip to content

Instantly share code, notes, and snippets.

@wavewave
Created February 2, 2013 16:32
Show Gist options
  • Select an option

  • Save wavewave/4698146 to your computer and use it in GitHub Desktop.

Select an option

Save wavewave/4698146 to your computer and use it in GitHub Desktop.
named pipe
import Control.Concurrent
import Control.Monad
import Control.Monad.Loops
import System.IO
import System.Posix.Files
main = do
-- createNamedPipe "/tmp/test.fifo" $ unionFileModes ownerReadMode ownerWriteMode
-- forever (hGetLine pipe >>= putStrLn)
pipestr <- iterateUntil (not.null) $ do
putStrLn "reading pipe"
threadDelay 5000000
readFile "/tmp/test.fifo" -- ReadMode
putStrLn pipestr
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment