samuel_x_winters_x
3/29/2005
The net/ssh code below works fine in irb, but dies when inside a rake
task.
task :publish do
require 'net/ssh'
Net::SSH.start('svr.com','usr','pwd') do |session|
shell = session.shell.sync
out = shell.pwd
puts out.stdout
end
end
[C:\dir]rake --rakefile ssh.rb publish
(in C:/dir)
rake aborted!
undefined method `stdout' for "C:/dir":String
C:/dir/ssh.rb:8
This is bizarre. When stepping through without rake in IRB it works
fine, and "out" is a Net::SSH struct:
irb(main):008:0> out
=> #<struct Net::SSH::Service::Shell::SyncShell::CommandOutput
stdout="/some_path_here\n", stderr=nil, status=0>
Any idea what is going on?