From: Roland G. <Rol...@al...> - 2000-11-09 07:54:35
|
"Hemming, Cliff" wrote: > I have found a interesting little problem that I was wondering if you could > shed some light on. When I running a process a perform a > $TELNET->expect( undef, "Wait For this"); > If the child process exits without sending that phrase, the expect perl > script does not return. I was wondering if this normal behavior or if I have > problem. I guess I'm really asking if Expect handles signals from the child > processes? Yes, this problem has already been reported, but should be solvable by expecting 'eof', which is activated when the child exits, so this is probably your best bet. Expect does not handle SIGCHILD (which it should; I intend a complete rewrite and have this on the feature list) but instead relies on EOF detection from the pty. But as the state machine is heavily patched, there might be some problems with that also. I'm already investigating this, but I guess this is best solved by a clean redesign, so it will take some time. Thanks for telling. Roland -- Rol...@gm... |
From: Hemming, C. <Cli...@AF...> - 2000-11-10 19:52:27
|
So how would I specify 'EOF' in the expect statement? > -----Original Message----- > From: Roland Giersig [SMTP:Rol...@al...] > Sent: Thursday, November 09, 2000 01:54 > To: Hemming, Cliff > Cc: exp...@li... > Subject: Re: Expect.pm > > "Hemming, Cliff" wrote: > > I have found a interesting little problem that I was wondering if you > could > > shed some light on. When I running a process a perform a > > $TELNET->expect( undef, "Wait For this"); > > If the child process exits without sending that phrase, the expect perl > > script does not return. I was wondering if this normal behavior or if I > have > > problem. I guess I'm really asking if Expect handles signals from the > child > > processes? > > Yes, this problem has already been reported, but should > be solvable by expecting 'eof', which is activated > when the child exits, so this is probably your best bet. > > Expect does not handle SIGCHILD (which it should; I intend a > complete rewrite and have this on the feature list) but > instead relies on EOF detection from the pty. But as the > state machine is heavily patched, there might be some problems > with that also. > > I'm already investigating this, but I guess this is best solved > by a clean redesign, so it will take some time. > > Thanks for telling. > > Roland > -- > Rol...@gm... |
From: Roland G. <Rol...@al...> - 2000-11-14 14:30:01
|
"Hemming, Cliff" wrote: > > So how would I specify 'EOF' in the expect statement? Simple: 'eof' is recognized as a special pattern, so you just say expect(['eof', \&callback, @callback_parms], ...); Unfortunately, EOF handling is somewhat broken, EOF is recognized and the callback activated, but the internal expect loop is not terminated and thus waits until timeout. I have a patch for this and will release a new Expect version within a few days. Hope this helps, Roland -- RGi...@cp... |
From: Roland G. <r.g...@xs...> - 2001-03-21 10:49:17
|
[I'm CCing this to the discussion list to generate some traffic there :-)] Dennis Hammer wrote: > I've got a problem with Expect.pm: > > $router->expect(2, ['Password:', sub {$router->send('password\r'); }]); > > the above line seems to match as the password string is sent, but > seemingly the string is only printed to the tty without sending it to > the application referenced by $router. Output looks like this: > > User Access Verification > > Password: password\r > > which is not quite the thing I wanted to achieve. > > Please tell me what the problem is. Make this '$router->send("password\r")' and it will work. q'' doesn't interpret '\r', so you are missing the end-of-line here. Don't be ashamed, it happens to the best of us... :-) Roland -- RGi...@cp... |
From: Roland G. <r.g...@xs...> - 2001-04-02 13:42:37
|
Dmitry Mottl wrote: > When I use Expect.pm to interact with program (mysqldump) which asks > for a password and dumps data to stdout, all lines are ended with "\r\n= ". > How can I change this behavior? I need lines ended with "\n" This behaviour could be changed by adjusting the terminal settings via exp_stty(), which takes a string with commands similar to =B4stty=B4. I'm no specialist for terminal settings, but "igncr" and/or=20 "-onlcr" could do what you want. OTOH, why do you need lines with "\n"? How about post-processing the output and removing the "\r" with =B4perl -e 's/\r+//g'=B4? If you have problems matching multiple lines, adjust your regexp by adding "\r*" before "\n". An even better way would be to use the Mysql perl module to directly=20 access the database without spawning an intermediate program. =20 Alternatively you could use the DBI module with its DBD::mysql driver=20 to keep the database exchangable. Hope this helps, Roland -- RGi...@cp... |