Jamshidh answer extension, if instead of getting stdout and stderr as String
you want to get them as ByteString
or Text
, you can use process-extras .
You can also use my process-streaming package:
$ import System.Process.Streaming $ execute (piped (shell "echo foo")) (liftA3 (,,) (foldOut intoLazyBytes) (foldErr intoLazyBytes) exitCode) ("foo\n","",ExitSuccess)
Also for Text
:
$ import System.Process.Streaming.Text $ execute (piped (shell "echo foo")) (liftA3 (,,) (foldOut (transduce1 utf8x intoLazyText)) (foldErr (transduce1 utf8x intoLazyText)) exitCode) ("foo\n","",ExitSuccess)
danidiaz
source share