Asp Forum
Home
|
Login
|
Register
|
Search
Forums
>
comp.lang.ruby
IO.popen fails to pen persistent ssh connection
Hector Quiroz
10/3/2008 2:51:00 PM
What the?
The following code(see below) works fine in a few of my ruby scripts but
fails on others with the following message:
'/scripts/ruby/testssh.rb:4: undefined method `exitstatus' for
nil:NilClass (NoMethodError)'.
I know ssh is working and I can run ssh commands to #{hostname} using
#{username} credentials. I use this exact code in other scripts from the
same workstation, ssh'ing to the same remote host and it works fine.
I've copied the following lines and pasted them unto a new file and it
still fails with the above message.
#!/usr/bin/ruby -w
ssh = IO.popen("ssh #{username}@#{hostname} -T", "w+")
status = $?
break unless (status.exitstatus == 0)
Help...
Thank you
Hector
--
Posted via
http://www.ruby-...
.
1 Answer
ara.t.howard
10/3/2008 3:53:00 PM
0
On Oct 3, 2008, at 8:51 AM, Hector Quiroz wrote:
> '/scripts/ruby/testssh.rb:4: undefined method `exitstatus' for
> nil:NilClass (NoMethodError)'.
>
> I know ssh is working and I can run ssh commands to #{hostname} using
> #{username} credentials. I use this exact code in other scripts from
> the
> same workstation, ssh'ing to the same remote host and it works fine.
>
> I've copied the following lines and pasted them unto a new file and it
> still fails with the above message.
>
>
> #!/usr/bin/ruby -w
> ssh = IO.popen("ssh #{username}@#{hostname} -T", "w+")
> status = $?
> break unless (status.exitstatus == 0)
>
the process has not exited yet - $? is therefore nil.
a @
http://codeforp...
--
we can deny everything, except that we have the possibility of being
better. simply reflect on that.
h.h. the 14th dalai lama
Servizio di avviso nuovi messaggi
Ricevi direttamente nella tua mail i nuovi messaggi per
IO.popen fails to pen persistent ssh connection
Inserendo la tua e-mail nella casella sotto, riceverai un avviso tramite posta elettronica ogni volta che il motore di ricerca troverà un nuovo messaggio per te
Il servizio è completamente GRATUITO!
x
Login to ForumsZone
Login with Google
Login with E-Mail & Password