Commit 27ed03ed authored by simonmar's avatar simonmar
Browse files

[project @ 2005-08-01 13:26:43 by simonmar]

add System.Process test
parent 35ad9b5f
test('process001', normal, compile_and_run, [''])
test('process002', normal, compile_and_run, [''])
test('process003', normal, compile_and_run, [''])
-- [ ghc-Bugs-1249226 ] runInteractiveProcess and closed stdin.
-- Fixed in rev 1.9 of fptools/libraries/base/cbits/runProcess.c
import System.IO
import Control.Concurrent
import System.Process
main = do
hClose stdin -- everything works as expected if the handle isn't closed.
putStrLn "Running cat ..."
(inp, out, err, pid) <- runInteractiveProcess "cat" [] Nothing Nothing
forkIO (hPutStrLn inp "foo" >> hClose inp)
mout <- newEmptyMVar
merr <- newEmptyMVar
forkIO (hGetContents out >>= \s -> length s `seq` putMVar mout s)
forkIO (hGetContents err >>= \s -> length s `seq` putMVar merr s)
-- Don't want to deal with waitForProcess and -threaded right now.
takeMVar mout >>= putStrLn
takeMVar merr >>= putStrLn
return ()
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment