Skip to content

Problem with Threading under GHC

hi ghc-friends,

i try the following code, but it don't work:

import System.Process
import Control.Concurrent
import System.IO
p = threadDelay 10000000
main3 = do 	putStrLn "test"
		hClose stdin
		(inp, out, err, pid) <- 
runInteractiveProcess "Test.exe" [] Nothing Nothing
		p
		forkIO (putStrLn =<< 
hGetContents out)
  		forkIO (putStrLn =<< 
hGetContents err)
		p
		putStrLn "inp"
 		forkIO (hPutStrLn inp "in" >> 
hClose 
inp)
		p
		forkIO (putStrLn =<< 
hGetContents out)
  		forkIO (putStrLn =<< 
hGetContents err)
		putStrLn "out"
		threadDelay 1000000
		forkIO (hPutStrLn inp "quit" >> 
hClose 
inp)
 		hShow out
		return ()

thanks for helping.
Trac metadata
Trac field Value
Version None
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution ResolvedNoReason
Component GHCi
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information