From: Roland G. <RGi...@cp...> - 2002-08-29 08:40:55
|
> > I would like to spawn an xterm and then send messages to it. > > > > .... > > .... > > $pid=Expect->spawn("/usr/bin/xterm"); > > # now send message to xterm > > print $pid "Hello from parent"; > > .... > > > > I get an xterm window with a shell prompt in it. > > But i don't see my message in it. > > Is there a way to do that ? ... > I think this kind of thing is discussed in the book Exploring > Expect by Don Libes. It's written for TCL Expect, but the general > principles should be the same. I never tried it, but I think > it involves allocating two pseudo-terminals and passing some > special options to xterm. Yes, most xterms have an option '-S' to put them into slave mode. What you basically do is: allocate a pty, get the name of the slave pty via 'ttyname($pty->slave)' and pass that via '-S' to the xterm. I cannot be more specific, as the format of the '-S' option is very system-dependend. And frankly, I haven't tried it with Perl/Expect but managed to do it with Tcl/Expect a long time ago... Hope this helps, Roland -- RGi...@cp... |