N
Nathan Halterman
I'm trying to interact with a RF Terminal application. But each time I
run this, it returns nothing from stdout, and just hangs irb. I've been
banging my head on this one for a couple days, because it seems right,
but nothing comes back from the server.
Any ideas? Thanks in advance.
run this, it returns nothing from stdout, and just hangs irb. I've been
banging my head on this one for a couple days, because it seems right,
but nothing comes back from the server.
Any ideas? Thanks in advance.
Code:
def test_rf(run_this)
Net::SSH.start('xx.xx.xx.xx', 'userid', :password => "password") do
|session|
session.open_channel do |channel|
channel.request_pty(:term => 'xterm') do |ch, success|
raise "could not request pty!" unless success
channel.send_data "2\n" # tell the shell to exit
end
puts "shell was started successfully!"
channel.send_data "2\n" # tell the shell to exit
sleep 3
channel.send_data "1\n" # tell the shell to exit
sleep 2
channel.send_data "Canada6-gen\t"
channel.send_data "Canada6-gen\t"
channel.send_data "\n"
channel.send_data "<ESC>0"
channel.send_data "2\n"
channel.send_data "0\n"
channel.on_data do |ch, data|
puts "got data: #{data.inspect}"
end
channel.on_close do
puts "shell terminated"
end
end
session.loop
end
end #test_rf