Reputation: 91
I am using Net::SFTP::Foreign with IO::Pty.
My Login Command is:
Net::SFTP::Foreign->new(host=> $server_address,
user => $user_id,
password => $password)
or die "Could not Connect To Server $server_address: $!";
When I am passing invalid entry for server/user/password, it's not throwing the error message. It's simply hanging on the command line and not giving any output ever after 30+ minutes.
Please help how to handle the errors, if there is any invalid input parameters.
If I am passing all the valid values, its working fine.
Upvotes: 3
Views: 1032
Reputation: 91
Finally, using the following option, I am able to handle the issue. Net::SFTP::Foreign::debug=-1; $sftp = Net::SFTP::Foreign->new( host=> $server_address, user => $user_id, password => $password, more=>'-vvv', timeout=>30);
This command will handle the wrong host_name, user_id or password. The job will fail after waiting for the no.of seconds given for timeout, if it is not able to establish a connection.
Upvotes: 2