On 30/08/05, David Vallner <david / vallner.net> wrote:
> Brian Schr?der wrote:
> 
> >On 15/08/05, LenS <lsumnler / uniqueinsuranceco.com> wrote:
> >
> >>In general how would you call the foo.exe program in ruby and check
> >>return code.
> >>
> >>
> >def execute(*args)
> >  system(*args)
> >  $?
> >end
> >
> >
> As a sworn hater of magic global variables, I'd like to know: Is there
> any way to do this that doesn't involve the "$?" ? Cheers
> 
> David Vallner
> 
> 
> 

Put the above into a library and use execute ;-).

The $? is a thread-local variable, so there is nothing bad about using
it like I did above. There is no possibility that another command
changes the $? before it is returned by "execute". And if you put it
into a function like I did you'll never again the the dollar sign.

Maybe the above mini-function could even get into facets if it's not
already there. Then you would never ever have seen the dollar sign.

regards,

Brian

-- 
http://ruby.brian-schroeder.de/

Stringed instrument chords: http://chordlist.brian-schroeder.de/