[prev in list] [next in list] [prev in thread] [next in thread] 

List:       ruby-core
Subject:    Re: Possible bug in $?
From:       "Charles O Nutter" <headius () headius ! com>
Date:       2006-06-26 22:13:15
Message-ID: fe35f8180606261513y6bf7ae0bu1154410c4fb3917c () mail ! gmail ! com
[Download RAW message or body]


I needed a good chuckle today. It turns out that the issue is double-quoting
the -e string. My shell is pre-substituting $? as 0.

headius@opteron:~/testrails/test4$ ruby -e 'fork { exit 99 }; Process.wait;
p $?.class'
Process::Status
headius@opteron:~/testrails/test4$ ruby -e "fork { exit 99 }; Process.wait;
p $?.class"
Fixnum

The second one ultimately executes "p 0.class", which obviously displays
Fixnum.

Nevermind!

On 6/26/06, Charles O Nutter <headius@headius.com> wrote:
>
> FYI, my ruby -v:
>
> ruby 1.8.4 (2005-12-24) [x86_64-linux]
>
> On 6/26/06, Charles O Nutter <headius@headius.com> wrote:
> >
> > Why does this print out "Fixnum":
> >
> > ruby -e "fork { exit 99 }; Process.wait; p $?.class"
> >
> > when all docs I can find say that $? should be a Process::Status object
> > (and it appears to be such when running in a script or in IRB)? Is there
> > some special behavior enabled for -e execution and process launches?
> >
> > --
> > Charles Oliver Nutter @ headius.blogspot.com
> > JRuby Developer @ www.jruby.org
> > Application Architect @ www.ventera.com
> >
>
>
>
> --
> Charles Oliver Nutter @ headius.blogspot.com
> JRuby Developer @ www.jruby.org
> Application Architect @ www.ventera.com
>
>


-- 
Charles Oliver Nutter @ headius.blogspot.com
JRuby Developer @ www.jruby.org
Application Architect @ www.ventera.com


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic