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

this is hanging indefinitely when I run it in win32.  If I add
in the print statement (commented out above) it works fine!  So
I can only imagine that waitForProcess is hanging when I haven't
drained the stdout stream.

How can I force hGetContents to be strict (or at least to completely
process the stream prior to the waitForProcess command)?

Tim Newsham
http://www.thenewsh.com/~newsham/
_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to