pipe through external process?

Jean-Baptiste Robertson [email protected]
Tue, 17 Jul 2001 02:08:22 +0100


Hi,

The POSIX functions you may want to try are open2 and open3.
Much trouble come from the Unix buffering : as you can't force
autoflushed output from the command, you'll simply have a deadlock 99%
of the time.
A solution (used in scsh, I think) is to send the stdout in a file and
then
to read the file. 

HTH
jb


John Meacham wrote:
> 
> I am trying to implement a function which takes a string, pipes it
> through an external command and returns the stdout of teh command
> utilizing the Posix library and ghc.
> 
> first of all, if someone has this handy code tidbit already written then
> feel free to send it to me. the other thing is that I cannot figure out
> how to get data into and out of the process. I can create a pipe which
> returns a pair of Fd's but then i cannot pass these into runProcess
> since it expects handles. also I have no ability to wait for the
> termination of the command that runProcess starts...
> 
> it is always possible i am just overlooking a few key functions in Posix...
> 
>         John
> --
> ---------------------------------------------------------------------------
> John Meacham - California Institute of Technology, Alum. - [email protected]
> ---------------------------------------------------------------------------
> 
> _______________________________________________
> Haskell-Cafe mailing list
> [email protected]
> http://www.haskell.org/mailman/listinfo/haskell-cafe

-- 
Jean-Baptiste Robertson <[email protected]>