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

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 Fri, 30 Mar 2007, Jim Freeze 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'.

--
be kind whenever possible... it is always possible.
- the dalai lama

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 3/30/07, ara.t.howard@noaa.gov <ara.t.howard@noaa.gov> wrote:

On Fri, 30 Mar 2007, Jim Freeze 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?

--
Jim Freeze

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 Sat, 31 Mar 2007, Jim Freeze wrote:

On 3/30/07, ara.t.howard@noaa.gov <ara.t.howard@noaa.gov> wrote:

On Fri, 30 Mar 2007, Jim Freeze 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

--
be kind whenever possible... it is always possible.
- the dalai lama

On 3/30/07, ara.t.howard@noaa.gov <ara.t.howard@noaa.gov> 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.

···

--
Alex

thank you!

-a

···

On Sat, 31 Mar 2007, Alexey Verkhovsky wrote:

On 3/30/07, ara.t.howard@noaa.gov <ara.t.howard@noaa.gov> 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.

--
be kind whenever possible... it is always possible.
- the dalai lama

Hi,

At Sat, 31 Mar 2007 02:02:11 +0900,
Alexey Verkhovsky 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.

···

--
Nobu Nakada

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:

···

On 4/2/07, Nobuyoshi Nakada <nobu@ruby-lang.org> wrote:

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

--
AV