On Mon, Jun 1, 2009 at 3:09 AM, Ivan Samonov <hronya / gmail.com> wrote:
> I use net/ssh library.
> My code:
> require 'rubygems'
> require 'net/ssh'
> Net::SSH.start('server', 'login') { |ssh| ssh.open_channel { |ch|
> ch.exec('false') { |ch, success| puts success }   > "false" is a console program and it always return 1.
> Why result of this program is "true"?   > I misunderstand something.

I just ran into the same problem last week and I ended up doing what
Robert suggested:

retcode = ch.exec('my_command >/dev/null 2>&1 ; echo $?')

you can also do things like is:
results = ch.exec('my_command && echo SUCCESS || echo FAILURE')

-- 
Aaron Turner
http://synfin.net/
http://tcpreplay.synfin.net/ - Pcap editing and replay tools for Unix & Windows
Those who would give up essential Liberty, to purchase a little temporary
Safety, deserve neither Liberty nor Safety.
    -- Benjamin Franklin