# Ssh output buffer getting cut off

**URL:** <https://www.ruby-forum.com/t/ssh-output-buffer-getting-cut-off/82528>\
**Category:** Ruby\
**Created:** [January 19, 2007, 4:31pm UTC](https://www.ruby-forum.com/t/ssh-output-buffer-getting-cut-off/82528 "2007-01-19T16:31:09Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![JacobS\_Raymond\_A\_Jr](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/898d66/32.png) [@JacobS\_Raymond\_A\_Jr](https://www.ruby-forum.com/u/JacobS_Raymond_A_Jr)\
**Post date:** [January 19, 2007, 4:31pm UTC](https://www.ruby-forum.com/t/ssh-output-buffer-getting-cut-off/82528/1 "2007-01-19T16:31:09Z")

</div>

I am running net-ssh(1.0.10) and ruby 1.8.2 (2004-12-25) [i386-mswin32]

When I execute the following:  
…  
session.process.open3("/usr/bin/netstat -pn") do  
|input,output,error|  
puts “#{output.read}”  
end  
…  
The output is cutoff. Logging into the system and running the command  
/usr/bin/netstat -pn | wc -c the command outputs 10219 bytes

When substite “ls -last” for “…/netstat -pn” I get all of the output  
Checking the amount of data returned by running: ls -last | wc -c the  
command outputs 6799 bytes.

My assumption is that there is default buffer size that I have exceeded  
or  
the buffer is waiting to be flushed and the process ends before this  
happens  
or there is something in my output that causes the buffer be flushed  
prematurely.

Does anyone have any suggestions on how I might overcome this problem.

Thank you  
raymond

---

<div class="post-metadata">

**Author:** ![JacobS\_Raymond\_A\_Jr](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/898d66/32.png) [@JacobS\_Raymond\_A\_Jr](https://www.ruby-forum.com/u/JacobS_Raymond_A_Jr)\
**Post date:** [January 19, 2007, 4:31pm UTC](https://www.ruby-forum.com/t/ssh-output-buffer-getting-cut-off/82528/2 "2007-01-19T16:31:16Z")

</div>

On 1/14/07, Jacob, Raymond A Jr [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> /usr/bin/netstat -pn | wc -c the command outputs 10219 bytes  
> prematurely.
> 
> Does anyone have any suggestions on how I might overcome this problem.

Long time ago somebody had similar problem with ssh truncating data. I  
don’t remeber whether it was on ruby-talk, ruby-core or mongrel-users,  
nor how did he solve it. I remember it involved scp. So try looking  
for scp in the archives.
