Hello Monks!
At Expect-1.21 (debian unstable version) and at Expect-1.32 (Gábor Szabó version), I can read:My script fails from time to time ... try using $exp->soft_close()And later:
This will wait 15 seconds for a processI have search at the code, and the delay is on Expect.pm:
$end_time = time() + 15;
while ( $end_time > time() ) {
Well, my question is.. I have configured ssh ControlMaster to yes.
Playing with Expect, the first connection will delay such 15 seconds:
If I try it with a not ssh master initial conection it works:system ('ssh -O exit localhost 2> /dev/null;'); use Expect; print Expect::version(); $su=new Expect; $su->log_user(1); $su->spawn ("ssh localhost echo aa"); $su->soft_close(); # this step hang 15 seconds # $su->expect(undef); exit 0;
system ('ssh -O exit localhost 2> /dev/null; ssh -M localhost -fN 2> /dev/null'); use Expect; $su=new Expect; $su->log_user(1); $su->spawn ("ssh localhost echo aa"); $su->soft_close(); # this step now will not take more than 1 second #$su->expect(undef); exit 0;
At the first moment I thought it was a ssh issue, but it run fine without Expect Perl module
Do you know what is happen there (why perl 'system' call detect the finish of ssh commands but Expect not)?
PD: To setup this example, you need pubkey auth on localhost (ssh-keygen + ssh-copy-id + ssh-agent (search about ssh passwordless if you did not know about)) Pd2: updated to clarify the questionIn reply to ssh controlmaster and expect perl module by i5513
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |