[Haskell-cafe] program execution and laziness
Henning Thielemann
lemming at henning-thielemann.de
Thu Sep 14 09:42:06 EDT 2006
On Wed, 13 Sep 2006, Tim Newsham wrote:
> I'm having a problem with program execution in win32 which seems
> to be tied to laziness. The function I'm using is:
>
> runCmd cmd outdir dir base ext = do
> let argv = words cmd
> (i,o,e,p) <- runInteractiveProcess (head argv) (drop 1 argv) Nothing
> Nothing
> hClose i
> out <- hGetContents o
> -- print out
> x <- waitForProcess p
> hClose o
> hClose e
> case x of
> ExitSuccess -> return 0
> (ExitFailure n) -> return n
Btw. you may want to enclose starting the process and closing the file
handles in a 'bracket'.
More information about the Haskell-Cafe
mailing list