in reply to Net::SSH::Perl doesn't like long commands
I can reproduce the problem myself. In my environment, Net::SSH::Perl hangs at some point between 8000 and 10000 characters.
Net::OpenSSH can handle the same commands without any issue (that's why I think the problem lies on Net::SSH::Perl):
#!/usr/bin/perl use strict; use Net::OpenSSH; use Net::SSH::Perl; my $host = $ARGV[0] // "localhost"; for my $len (10, 100, 1000, 2000, 4000, 6000, 8000, 10000, 20000, 5000 +0) { my $cmd = "echo "; $cmd .= "." x $len; warn "trying with Net::OpenSSH, len=$len...\n"; my $ssh1 = Net::OpenSSH->new($host); my ($stdout1, $stderr1) = $ssh1->capture($cmd) or die "Failed!\n"; warn "Failed $?!\n" if $?; warn "trying with Net::SSH::Perl, len=$len...\n"; my $ssh2 = Net::SSH::Perl->new( $host, # debug => 1, options => [ "BatchMode yes", "PasswordAuthenticati +on no", "ConnectTimeout 15" ] + ); $ssh2->login("root") or die "Failed to login: $!\n"; warn "logged\n"; my ($stdout2, $stderr2, $exit) = $ssh2->cmd($cmd); warn "Failed $exit!\n" if $exit; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Net::SSH::Perl doesn't like long commands
by BrowserUk (Patriarch) on Jun 10, 2013 at 12:23 UTC | |
by vsespb (Chaplain) on Jun 10, 2013 at 13:33 UTC | |
by salva (Canon) on Jun 10, 2013 at 13:38 UTC | |
by pattyj (Novice) on Jun 10, 2013 at 13:07 UTC | |
by BrowserUk (Patriarch) on Jun 10, 2013 at 13:12 UTC |