From: Reto Schuettel Date: 2006-04-21T14:30:33+09:00 Subject: Re: Strange problem with PTY.spawn() Hi John On Fri, Apr 21, 2006 at 11:24:01AM +0900, John Carter wrote: > On Tue, 11 Apr 2006, Reto Schuettel wrote: > > >Let me ask another question. Why should I (or RExpect, to be precise) > >use PTY at all? As far as I can see it only spawns a programm and gets > >stdin/stdout. > > One and only one (weak) reason. The pty interface permits you to drive > programs that have the implicit expectation that they are been driven > from a keyboard / screen combo and use the termios (Say "man termios" for > more info). > functions on the STDIN/STDOUT fd's. Or like ssh *gbrml*. ssh alway breaks out of my open3 and is able to talk with the terminal directly. Is there no way to tell ssh to not use the pty? With telnet it was fine... > >Couldn't I use open3/open4 for the same purpose? I've > >modified/extended the RExpect a little bit, so I'm alread used to the > >internals, from my point of view I can't see any differences to the Open > >libraries. > > I did make a (very small) start on a open3 interface to RExpect. If you > feel like contributing your fixes back I would welcome them. I'm currently hoping that nobu can fix the pty problem and I can switch back to PTY.spawn(). I tried it with a modified version of open4 but it caused more problem than it solved :/. I'm gonna diff original version of Rexpec and mine version, and if there any any major 'enhancements' I'm happy to give them to you. E.g. I tried to get rid of the 'abort on exception' thing because in my case Rexpect is used by a long-running process. Errors should be packed into Exceptions and returned to the program and all threads should be cleaned up. > >I have to talk network devices (Cisco Router/Switches) over ssh/telnet > >session (ssh prefered, of course ;)). > > I originally wrote rexpect to pretend to be lots and lots and lots of > imaginary devices on the end of lots and lots of imaginary rs-232 lines. > > Currently my only use is to use 'ssh' to takeover my colleagues boxes > and install, configure and run distcc on them. I think one 'common' expect module would be very useful. At the moment there are some projects like PTY.expect, Rexpect, yax (i think), but none of these are really in a 'real' stable state. Perl has stable Expect modules for years now... and they run on linux, solaris, whatever without the need to touch the program. Regards, Reto Sch�ttel