On Sun, Nov 02, 2008 at 09:15:25PM +0100, Marc Weber wrote: > 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 looks to me like this code requires a forkIO, not in the writing to inp, but rather in the reading of out and err. Otherwise, those buffers may fill up and your process will hang... -- David Roundy http://www.darcs.net _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe