Workaround for 1.8.6 with CommandLine

Hello

If you are using ruby-1.8.6, you may have noticed a bug where exit
always
returns 0 when called from within an at_exit block. You can test this
on your
machine with the following little snippet:

ruby -e ‘at_exit { exit(1) }’ ; echo $?

The result should be ‘1’, but ruby-1.8.6 will return ‘0’.

To workaround this when using commandline, you can change an application
that reads like:

require ‘rubygems’
require ‘commandline’
class App < CommandLine::Application
end

to

require ‘rubygems’
require ‘commandline’
class App < CommandLine::Application_wo_AutoRun
end
App.run

This will not use the at_exit technique of self launching the app and
give the correct
exit code.

Jim

On Fri, 30 Mar 2007, Jim F. wrote:

Hello

If you are using ruby-1.8.6, you may have noticed a bug where exit always
returns 0 when called from within an at_exit block. You can test this on your
machine with the following little snippet:

ruby -e ‘at_exit { exit(1) }’ ; echo $?

The result should be ‘1’, but ruby-1.8.6 will return ‘0’.

wow. i rely on that combination in a few places, in particular i
dis-inherit
exit
handlers in child processes by doing this as the first line

at_exit{ exit! status }

do you know if it’s a bug or new behaviour?

-a

On 3/30/07, [email protected] [email protected] wrote:

On Fri, 30 Mar 2007, Jim F. wrote:

wow. i rely on that combination in a few places, in particular i dis-inherit
exit
handlers in child processes by doing this as the first line

at_exit{ exit! status }

do you know if it’s a bug or new behaviour?

As I understand it (and according to Nathaniel Talbot), it is a bug
and breaks testunit.
See bug 9300 at:

http://rubyforge.org/tracker/?func=detail&atid=1698&aid=9300&group_id=426

On Sat, 31 Mar 2007, Jim F. wrote:

do you know if it’s a bug or new behaviour?

As I understand it (and according to Nathaniel Talbot), it is a bug
and breaks testunit.
See bug 9300 at:

http://rubyforge.org/tracker/?func=detail&atid=1698&aid=9300&group_id=426

good to know. i’m preparing and installer for a classified system that
was
going to use 1.8.6 as we speak! i’ve revert to 1.8.5. thanks a bunch.

-a

On 3/30/07, [email protected] [email protected] rote:

do you know if it’s a bug or new behaviour?

It’s a bug. Already fixed in 1.9, but I haven’t heard anything about
applying the fix to 1.8 branch yet. Which is unfortunate, as it breaks
quite
a few things.

On Sat, 31 Mar 2007, Alexey V. wrote:

On 3/30/07, [email protected] [email protected] rote:

do you know if it’s a bug or new behaviour?

It’s a bug. Already fixed in 1.9, but I haven’t heard anything about
applying the fix to 1.8 branch yet. Which is unfortunate, as it breaks quite
a few things.

thank you!

-a

On 4/2/07, Nobuyoshi N. [email protected] wrote:

It was fixed in 1.8, and doesn’t exist in 1.9.

Ah, that is correct. Sorry for the confusion.

Is there any prospect of patch release soon? I just had to write
something
like: “Prerequisites: Ruby 1.8.4 or 1.8.5 (but there is a known bug in
1.8.6)”
in CruiseControl.rb 1.1 release documentation. This just doesn’t look
good… :frowning:

Hi,

At Sat, 31 Mar 2007 02:02:11 +0900,
Alexey V. wrote in [ruby-talk:246032]:

It’s a bug. Already fixed in 1.9, but I haven’t heard anything about
applying the fix to 1.8 branch yet. Which is unfortunate, as it breaks quite
a few things.

It was fixed in 1.8, and doesn’t exist in 1.9.