[Haskell-cafe] Blocking IO & FIFOs

Jason Dusek jason.dusek at gmail.com
Sat Oct 20 16:00:41 CEST 2012

2012/10/20 Asten, W.G.G. van (Wilfried, Student M-CSC)
<w.g.g.vanasten at student.utwente.nl>:
> Would you be happy with a solution like this:
>  - First create two handles to two files in the tmp directory
>  - Then use StdStream's UseHandle to redirect std_err and std_out
> (using CreatePipe for std_in) to these files
>  - Then write your query to the Handle for std_in
>  - waitForProcess
>  - Collect std_out and std_err from the temporary files.
> If that is not satisfactory you may want to check out conduit-process
> (http://hackage.haskell.org/packages/archive/process-conduit/
> that also does some interaction with a process and interleaves std_in
> and std_out.  It should not be to hard to combine std_err into that
> concept. I also faced this same problem and in one case solved it by
> using a temporary file to hold my content which was also deleted
> afterwards (This immediately prevented the content building up in
> memory).

For my application, it's important to be able to run multiple
queries against the same Bash session. Waiting for Bash to shut
down is thus not a viable way to finalize the response.

Perhaps I can spawn two cats with their outputs connected to the
FIFOs and wait for them to terminate.

Jason Dusek
pgp // solidsnack // C1EBC57DC55144F35460C8DF1FD4C6C1FED18A2B

More information about the Haskell-Cafe mailing list