Skip Menu |

This queue is for tickets about the Net-SSH-Perl CPAN distribution.

Report information
The Basics
Id: 43256
Status: rejected
Priority: 0/
Queue: Net-SSH-Perl

People
Owner: Nobody in particular
Requestors: anirban [...] perl.org.in
Cc:
AdminCc:

Bug Information
Severity: Critical
Broken in: (no value)
Fixed in: (no value)



Subject: Issue with <timeout> parameter in $ssh->exec()
Hi, I have been using v1.09 of Net::SSH::Expect and observed an issue with the timeout feature in the exec() method. At present specifying a timeout does not necessarily ensure that my exec() call will return to the caller after the specified duration. This is because the call from the method read_all() will only return when it detects a <timeout> period of inactivity on the input stream (as also mentioned in the documentation). Which means, if I have launched a command CMD1, using $ssh->exec(CMD1, n), and CMD1 prints to the STDOUT indefinitely, then my caller script will also keep on waiting indefinitely for the exec() call to finish. However, I was able to achieve the desired functionality, wherein there is a provision to ensure that an exec() call returns to caller after a specified interval, by making some changes to the code in Net/SSH/Expect.pm. Following are the differences between my modified file and the original file for v1.09: ----------------- $ diff -b Expect.pm Expect.pm.original 419,420d418 < my $cmd_timeout = shift; < my $start = time; 423,425d420 < if (defined $cmd_timeout) { < last if ((time - $start) > $cmd_timeout); < } 473d467 < my $cmd_timeout = shift; 475,477d468 < if (defined $cmd_timeout) { < return $self->read_all($timeout, $cmd_timeout); < } ----------------- Hope there is a change to accommodate this issue in a future release. If you need any other inputs, feel free to contact me. Regards, Anirban Ghosh
This ticket was assigned to the wrong module. The correct ticket is already opened to Net-SSH-Expect in RT#43257. Closing. Steffen -- Steffen Schwigon <ss5@renormalist.net> Dresden Perl Mongers <http://dresden-pm.org/>