On Fri, Mar 20, 2015 at 8:36 PM, Daniel Díaz <diaz.carr...@gmail.com> wrote:

> One doubt: when using pipeOutputError, is it possible to take the output
> and error producers and consume them concurrently in separate threads, for
> example using the *Concurrently
> <http://hackage.haskell.org/package/async-2.0.2/docs/Control-Concurrent-Async.html#t:Concurrently>
> *applicative from *Control.Concurrent.Async*?
>

Certainly you can consume them concurrently--in fact,  you would need to,
or else the subprocess might block when its standard error or standard
output fills up.  Each Producer returned by 'pipeOutputError' has an
independent connection to the respective subprocess 'Handle'; concurrent
threads will pull data from the subprocess and each 'Producer' will 'yield'
its respective 'ByteString's.  You do, however, have to make sure that the
'Consumer' that you hook to the 'Producer' for stdout (or the 'fold' you
want to run, or however you want to do it) runs concurrently with the
ultimate 'Effect' that pulls from standard error.  There is a 'conveyor'
function that makes it easy to run an 'Effect' in a background thread.

I will add an example to Pipes.Cliff.Examples showing how to pull from
standard output and standard error.

-- 
You received this message because you are subscribed to the Google Groups 
"Haskell Pipes" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to haskell-pipes+unsubscr...@googlegroups.com.
To post to this group, send email to haskell-pipes@googlegroups.com.

Reply via email to