[Haskell-cafe] Can't figure out source of race condition when using System.Process

Marc Weber marco-oweber at gmx.de
Sun Nov 2 15:15:25 EST 2008


On Mon, Nov 03, 2008 at 01:02:12AM +1100, Rafal Kolanski wrote:
>  Rafal Kolanski.
> -- Pass text to md5sum and drop the final "  -" when returning
> hashMD5 text = do
>     (inp,out,err,pid) <- runInteractiveProcess "md5sum" [] Nothing Nothing
>     forkIO $ do 
>         hPutStrLn inp text
>         hClose inp
>     exit <- waitForProcess pid
>     case exit of ExitFailure _ -> error "md5sum fail" 
>                  _ -> return ()
> [...]

Why do you use forkIO here? It's not necessary. The process will run in
background on its own. ?

It would help me tracking the problem down having a full compilable
example..

Sincerly
Marc Weber


More information about the Haskell-Cafe mailing list