
15 Sep
2010
15 Sep
'10
2:08 p.m.
Hi, I'm trying to capture the output (stdout) of a command on Windows. This is what I have so far: import System.Process (runProcess, waitForProcess) import System.IO (hGetContents) executeCapturingStdout :: String -> String -> IO [String] executeCapturingStdout cmd workingDir = do let stdoutHandle = -- TODO: What do I put here? processHandle <- runProcess cmd [] (Just workingDir) Nothing Nothing stdoutHandle Nothing exitCode <- waitForProcess processHandle content <- hGetContents stdoutHandle return lines content I have tried searching on google and I haven't been able to find an answer yet. Thanks, Dave