add processGroup001/processGroup002
[packages/unix.git] / tests / 1185.hs
1 module Main where
2
3 import Control.Concurrent
4 import System.Posix
5 import System.IO
6 import System.Exit
7
8 main =
9 do putStrLn "running..."
10 (stdinr, stdinw) <- createPipe
11 (stdoutr, stdoutw) <- createPipe
12 pid <- forkProcess $ do hw <- fdToHandle stdoutw
13 hr <- fdToHandle stdinr
14 closeFd stdinw
15 hGetContents hr >>= hPutStr hw
16 hClose hr
17 hClose hw
18 exitImmediately ExitSuccess
19 threadDelay 100000
20 closeFd stdoutw
21 closeFd stdinw
22 hr2 <- fdToHandle stdoutr
23 hGetContents hr2 >>= putStr
24 getProcessStatus True False pid >>= print