aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/1185.hs
diff options
context:
space:
mode:
authorGravatar Simon Marlow <marlowsd@gmail.com>2009-10-21 09:07:41 +0000
committerGravatar Simon Marlow <marlowsd@gmail.com>2009-10-21 09:07:41 +0000
commit3ffe5680e675def6754896ef480a10d85d9c04d2 (patch)
tree43cac502a3d326d8d5b2683e57c7f84b062f289d /tests/1185.hs
parentfab44c12e7f91e0d81e1d3d0b60ffc970e8e915d (diff)
add a test for #1185
Diffstat (limited to 'tests/1185.hs')
-rw-r--r--tests/1185.hs24
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