in reply to Re: Issue with Expect
in thread Issue with Expect
screen shot: Sending ls command! Starting EXPECT pattern matching... at /export/dmzsupp/perl5/5.14.2/lib/site_perl/5.14.2/Expect.pm line 5 +61 Expect::expect('Expect=GLOB(0x65ca28)', 6, 'ARRAY(0x9b6460)', +'ARRAY(0x9b6328)', '-re', 'Regexp=REGEXP(0x9990d8)') called at ./fwlo +gin.pl line 42 Error,Timeout while waiting 6 secs for ls command on [sol8server] user +[user]. Error:1:TIMEOUT Continuing $VAR1 = [ undef, '1:TIMEOUT', undef, '', undef, undef ]; The code: print "\nSending ls command!\n\n"; $sshFW->send("ls\r"); @exp_stat = $sshFW->expect($expTimeOut, # Timeout trap [timeout => sub { $expFWStatus = 1; $expFWmatchString = $sshFW->match; print "Error,Timeout while waiting $expTimeOut secs for ls com +mand on [$FWHost] user[$usr]. Error:" . $sshFW->exp_error() . "\n"; + } ], # EOF trap [eof => sub { $expFWStatus = 2; $expFWmatchString = $sshFW->match; print "Error,Premature EOF during ls command for [$FWHost] use +r[$usr]. Error:" . $sshFW->exp_error() . "\n"; } ], '-re', qr /% $/, ); # End expect, got Unix prompt ok print "\nContinuing\n\n"; print Dumper(\@exp_stat);#debug # The above behaves just like the ls command was never sent!
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Issue with Expect
by zengargoyle (Deacon) on Mar 23, 2012 at 03:45 UTC | |
by azstyx (Acolyte) on Mar 23, 2012 at 20:32 UTC |