Re: [Haskell-cafe] Re: interaction between OS processes

2007-09-21 Thread Andrea Rossato
On Fri, Sep 14, 2007 at 01:55:32AM +, Aaron Denney wrote:
 On 2007-08-31, Andrea Rossato [EMAIL PROTECTED] 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).
 
 I'd like to convince you otherwise:

Sorry if I came back so late, but I wanted to thank you for taking the
time to show me I was making not one, but two errors.

Yes indeed, you are right, if I have access to the buffering of both
processes I can send messages from one to the other. Now I start
grasping something more about buffering and terminals.

Thank you.
Andrea

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Re: interaction between OS processes

2007-09-14 Thread Bryan O'Sullivan

Aaron Denney wrote:


If you want expect like functionality, i.e. working for arbitrary
client programs, you'll need to use pseudottys, as expect, script,
screen, xterm, etc. do.


I packaged up a patch for System.Posix to add this a month or three ago, 
but forgot to follow through on it.  Thanks for the (albeit indirect) 
reminder :-)


b
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Re: interaction between OS processes

2007-08-31 Thread Krzysztof Kościuszkiewicz
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: [EMAIL PROTECTED]
Mobile IRL: +353851383329,  Mobile PL: +48783303040
Simplicity is the ultimate sophistication -- Leonardo da Vinci
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Re: interaction between OS processes

2007-08-30 Thread Aaron Denney
On 2007-08-30, Andrea Rossato [EMAIL PROTECTED] wrote:
 Hi,

 there's something I don't get about interaction among OS processes and
 Haskell handles/channels.

This looks like a buffering problem.  You might be able to make it work by
explicitly setting line buffering with hSetBuffering

-- 
Aaron Denney
--

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe