catch the stdout when execute a shell cmd

24 Jan
2007
24 Jan
'07
2:13 a.m.
I use "system" in System.Cmd to execute a shell cmd, then how can I catch its stdout? -- Sincerely, Forest Liu(�����S)

24 Jan
24 Jan
2:19 a.m.
oxware:
I use "system" in System.Cmd to execute a shell cmd, then how can I catch its stdout?
Use System.Process, http://haskell.org/ghc/docs/latest/html/libraries/base/System-Process.html And example, call the 'date' program:
(inh,outh,errh,pid) <- runInteractiveProcess "date" ["+%d:%m:%y"] Nothing Nothing hClose inh hGetContents outh "24:01:07\n"
Regards, Don There's some wrappers to this floating around too, which should get into base soon enough.. E.g. http://www.cse.unsw.edu.au/~dons/code/newpopen/
6694
Age (days ago)
6694
Last active (days ago)
1 comments
2 participants
participants (2)
-
dons@cse.unsw.edu.au
-
Forest Liu