From: switheyw@... Date: 2008-02-27T04:24:55+09:00 Subject: Re: Having trouble reading from stderr After I generated my own key file and ran your example (except with gets) and with my key file, the system waited for a few Minutes and generated this: poplar% time ./x.rb ssh: connect to host gatewaymachine.com port 22: Operation timed out ./x.rb 0.00s user 0.01s system 0% cpu 2:14.79 total If nothing is able to be read from stderr, I suppose the read/gets call will hang - you might want to put the read of stderr in a thread. Something like this: Thread.new { loop { puts "Err stream: #{stderr.gets}" } } you can always receive a partial msg by placing the number of bytes to read in the read call, ie stderr.read(5) ....