Subject: | Problem with large stdin to cmd call |
perl 5.8.0,
$ ssh -V
OpenSSH_3.5p1, SSH protocols 1.5/2.0, OpenSSL 0x0090701
I have a problem when giving a large (+60 KB) file to stdin in the cmd call. Transmitting the file will often fail. Enabling compression will "sometimes" solve it. Here are the code that will fail:
# Set up the SSH connection
my $ssh = Net::SSH::Perl->new($compile_host,
debug => $debug,
protocol => 2,
compression => 1,
options => [ "LogLevel DEBUG3",
"ConnectionAttempts 2",
"StrictHostKeyChecking yes",
"BatchMode yes",
"RhostsAuthentication no",
"PasswordAuthentication no",
"PreferredAuthentications publickey" ])
;
if (!defined $ssh) {
# Error - unable to open connection
&my_error("Error connecting to compile service");
}
# Open it
$ssh->login($compile_user);
# Prepare stdin for the ssh program
my $stdin = "ENVIRONMENT = $environment\n";
while (<$filehandle>) {
$stdin .= $_;
}
close($filehandle);
############################################################
# Run the command
#
my ($out, $err, $exit)
= $ssh->cmd("/home/someprog.pl", $stdin);
When the file in filehandle is larger than some value, it will not always arrive at the receiver.
Really, really annoying.