[Haskell-cafe] Re: interaction between OS processes

Krzysztof Kościuszkiewicz k.kosciuszkiewicz at gmail.com
Fri Aug 31 16:24:35 EDT 2007


On Fri, Aug 31, 2007 at 11:31:38AM +0200, Andrea Rossato wrote:

> Thanks for your kind attention, but I don't think it's a matter of
> buffering (I indeed tried playing with hSetBuffering with no results).

That is because you need to change output buffering on both ends. I
don't know about haskell, but stdio says that handles to tty's are
line-buffered, stderr is not buffered and all other handles are fully
buffered. Of course you can flush the handles instead.

> Basically I'd like to write the equivalent of "expect", which talks to
> interactive programs (with the difference the mine is supposed to talk
> to a program I wrote, so I don't need to embed a domain specific
> language in it).

AFAIR expect uses pseudo-ttys (ptys) because in general one can't force
a program to change it's output buffering mode, so forcing it to talk to
a pair of terminals instead of fifos is used as a workaround.  Have a
look at pty(7).

Cheers,
-- 
Krzysztof Kościuszkiewicz
Skype: dr.vee,  Gadu: 111851,  Jabber: kokr at jabberpl.org
Mobile IRL: +353851383329,  Mobile PL: +48783303040
"Simplicity is the ultimate sophistication" -- Leonardo da Vinci


More information about the Haskell-Cafe mailing list