Subject: | Channel remains open after finishing command |
Tested with the following code. Once you enter the filehandle there is an infinite loop there.
This was working in version 58, does not work anymore since version 59. The command returns a cat of some lines in a server.
my $g_ssh = Net::SSH2->new(trace => -1);
$g_ssh->connect($server) or $g_ssh->die_with_error;
$g_ssh->auth(username => $username,
password => $password,
passphrase => undef) or $g_ssh->die_with_error;
my $channel = $g_ssh->channel() or do { die " [LOG ERROR]: Failed to create channel. Exiting ...\n"};
$channel->exec($command);
sleep(3);
while (my $line = <$channel>) {
$stdout .= $line;
print $line if ($debug_prints eq 1);
}
$channel->close();
$g_ssh->disconnect();