diff options
Diffstat (limited to 'tests/1185.hs')
-rw-r--r-- | tests/1185.hs | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/1185.hs b/tests/1185.hs new file mode 100644 index 0000000..4948417 --- /dev/null +++ b/tests/1185.hs @@ -0,0 +1,24 @@ +module Main where + +import Control.Concurrent +import System.Posix +import System.IO +import System.Exit + +main = + do putStrLn "running..." + (stdinr, stdinw) <- createPipe + (stdoutr, stdoutw) <- createPipe + pid <- forkProcess $ do hw <- fdToHandle stdoutw + hr <- fdToHandle stdinr + closeFd stdinw + hGetContents hr >>= hPutStr hw + hClose hr + hClose hw + exitImmediately ExitSuccess + threadDelay 100000 + closeFd stdoutw + closeFd stdinw + hr2 <- fdToHandle stdoutr + hGetContents hr2 >>= putStr + getProcessStatus True False pid >>= print |