Skip Menu |

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

Report information
The Basics
Id: 124412
Status: new
Priority: 0/
Queue: SSH-Command

People
Owner: Nobody in particular
Requestors: chas.owens [...] gmail.com
Cc:
AdminCc:

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



Subject: fixed buffer in execute_command_and_get_answer seems to limit the usefulness of ssh_execute
Date: Tue, 13 Feb 2018 10:43:12 -0500
To: bug-SSH-Command [...] rt.cpan.org
From: "Chas. Owens" <chas.owens [...] gmail.com>
There is a fixed read in execute_command_and_get_answer that limits the output to 8k on my Mac OS machine (and a similar if not identical limit on Linux). This fixed read does not seem to be necessary as Net::SSH2 provides an eof function on channels to tell you the channel has been closed. Changing the code to sub execute_command_and_get_answer { my ($ssh2, $command) = @_; my $chan = $ssh2->channel(); $chan->exec($command); my $result = ""; until ($chan->eof) { $chan->read(my $buf, 4_096); $result .= $buf; } chomp $result; # remove \n on string tail return $result; } seems to fix the problem (at least on my machine).