Today I get to jump in to the net::ssh gem to start using it to control
remote linux boxes. Loaded up the rubyforge page here:
http://net-ssh.rubyforge.org/ssh/v2/api/index.html
and checked out some examples. Tried out the example on my own like so:
require "rubygems"
require "net/ssh"
opts = {}
opts[:password] = #omitted, but triple-checked for correctness
#actual server, user names omitted to protect the innocent
sess = Net::SSH.start "my.server.com", "my_user", opts
#this works fine, outputting my_user's home dir
rslt = sess.exec!("pwd").strip
p rslt
#Here, "...in the block" never prints
sess.exec "pwd" do |ch, stream, data|
p "...in the block"
if stream == :stderr
p "Error: #{data}"
else p data
end
end
Why doesn't the block ever start? It's almost exactly the same as the
example on rubyforge?
Thanks,
Alex