[Haskell-beginners] Capture stdout from a command on Windows
maciej.podgurski at googlemail.com
Wed Sep 15 15:49:19 EDT 2010
you might use runInteractiveProcess which returns the process handle and
three handles hIn, hOut and hErr for communication with the process.
David Frey wrote:
> 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
> Beginners mailing list
> Beginners at haskell.org
More information about the Beginners