[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Re: Open3 and ssh

Brian Candler

9/2/2008 7:41:00 PM

I think your problem is that the -T option explicitly *prevents* the far end
opening a pty. It works for me if I change this to "ssh -tt localhost"
(having two -t options forces opening a pty even though the local end
doesn't have one). Note that this is under Ubuntu Linux though, not OSX.

You should also add "STDOUT.sync = true" at the top of your program, or else
remember to flush STDOUT after each print.

However, spawning the ssh client like this is pretty yucky, especially if
you want to avoid interactive prompting for passwords/passphrases, unknown
ssh host keys etc.

You could instead try using the Net::SSH library, written entirely in Ruby.
Its native API is awkward, but there is a separate Net::SSH::Telnet shim
which makes it work like Net::Telnet. I find it very powerful for scripted
access to devices.

http://net-ssh.ruby...
http://rubyforge.org/projects/net-s...

Regards,

Brian.