Advertisement
Guest User

ruby_ssh

a guest
Jul 19th, 2015
238
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 0.40 KB | None | 0 0
  1. require'net/ssh'
  2.  
  3. q = Queue.new
  4.  
  5. Thread.start{
  6. #   Net::SSH.start("xxx.xxx.xxx.xxx", "username", :password=>"password"){|ssh|
  7.  
  8.         exeCommand = "gdb ~/work/a.out"
  9.         ssh.exec(exeCommand){|channel, success|
  10.             raise "failed to execute command [#{exeCommand}]" unless success
  11.  
  12.             q.push "connect success"
  13.             channel.on_data{|c,data|
  14.                 q.push data
  15.             }
  16.             ssh.loop
  17.         }
  18.     }
  19. }
  20.  
  21. loop{
  22.     puts q.pop
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement