On Wed, 5 Nov 2008, Nathan Halterman wrote:

> 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.  :)

While you're waiting for someone who knows Net::ssh to reply, I'd add 
LOTS more diagnostics:
> 
> [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
 +          puts "about to send 2\\n"
            # channel.send_data "2\n" # tell the shell to exit
            x = channel.send_data "2\n" # tell the shell to exit
            puts "sent, the result was #{x}"
>         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
        puts "session.open_channel completed, about to call loop"
> 
>       session.loop
        puts "got past loop statement"
> 
>     end
      puts "Net ssh start completed.
> 
>   end #test_rf
> [/code]
> -- 
> Posted via http://www.ruby-forum.com/.
>