#1185: can't do I/O in the child of forkProcess with -threaded
---------------------------------+------------------------------------------
Reporter: simonmar | Owner:
Type: bug | Status: new
Priority: normal | Milestone: 6.10.2
Component: Runtime System | Version: 6.6
Severity: normal | Resolution:
Keywords: | Difficulty: Easy (1 hr)
Testcase: | Os: Unknown/Multiple
Architecture: Unknown/Multiple |
---------------------------------+------------------------------------------
Comment (by simonmar):
Here's the sample code that demonstrates the problem, from
[http://www.haskell.org/pipermail/glasgow-haskell-
users/2007-March/012062.html], with an extra `threadDelay` inserted to
make the hang show up more reliably:
{{{
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
}}}
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/1185#comment:12>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
_______________________________________________
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs