Sorry Mads for multiple copies.

On 16/01/07, Mads Lindstrøm <[EMAIL PROTECTED]> wrote:
The function System.system (:: String -> IO ExitCode) makes the OS
execute it first parameter as a command. It prints its output to
standard output and standard error.

How do I easily capture this output?

Try System.Process.runInteractiveCommand:

import System.Process
import System.IO

main = do
 (inH, outH, errH, _) <- runInteractiveCommand "wc -w"
 hPutStr inH "foo bar baz"
 ws <- hGetContents outH
 putStrLn ws

-- Prints 3

--
-David House, [EMAIL PROTECTED]
_______________________________________________
Haskell mailing list
Haskell@haskell.org
http://www.haskell.org/mailman/listinfo/haskell

Reply via email to