From: Motohiro KOSAKI <kosaki.motohiro@...>
Date: 2011-09-10T21:07:53+09:00
Subject: [ruby-core:39449] [Ruby 1.9 - Bug #5197][Rejected] at_exit order has changed in 1.9.3dev32413


Issue #5197 has been updated by Motohiro KOSAKI.

Status changed from Feedback to Rejected

> What I need is this:
> 
> 1) minitest, like test/unit before it, runs its tests via at_exit.
> 2) Users need to be able to register code to run AFTER the tests run (for extra reporting, or > resource cleanup). This was usually done with:
>
>    at_exit { at_exit { codes } }

Yeah, It's clearly bad code.

quote from [ruby-core:35254]. Matz wrote, 
> OK, I choose C's behavior.  Although I don't recommend to rely too
> much on the atexit order.  Motohiro, could you check in?

I'm stand aside matz. don't do that.



> which I wrapped up in a method called #after_tests(&b).
>
> Now that doesn't work. 

Not now. It has been broken long time.
Even if I revert MRI change, It doesn't work on other ruby implementation.

So, I don't understand why we need revert the code even if it doesn't solve the problem.


> I need some mechanism to make this work as its been available this way for 10+ years. 
> I don't care what mechanism I wind up using, as long as it works.

I pity the 10+ years broken code.
And one correction. This behavior was introduced following commit. see date.

------------------------------------------------------------------------------------
commit a3e1b1ce7ed7e7ffac23015fc2fde56511b30681
Author: ko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>
Date:   Sun Dec 31 15:02:22 2006 +0000

        * Merge YARV

    git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11439 b2dd03c8-39d4-4d8f-98ff-823fe69b080e


Last of all.
But, as far as that a revert solve a issue, I'd like to choose a revert. Please remember it.

Thanks.




----------------------------------------
Bug #5197: at_exit order has changed in 1.9.3dev32413
http://redmine.ruby-lang.org/issues/5197

Author: Ryan Davis
Status: Rejected
Priority: Normal
Assignee: Motohiro KOSAKI
Category: core
Target version: 1.9.3
ruby -v: 1.9.3dev32413


I could have sworn I filed or mailed this before, but I can't find it. Sorry if this is a dupe.

#!/usr/bin/ruby -w

happy = false
at_exit { happy = true }                                # test runner
at_exit { at_exit { abort "not happy!" unless happy } } # after test hook

# multiruby produces:

# VERSION = mri_trunk
# CMD     = ~/.multiruby/install/mri_trunk/bin/ruby -v -Ilib bug4.rb
#
# ruby 1.9.3dev (2011-07-05 trunk 32413) [x86_64-darwin10.8.0]
# not happy!
#
# RESULT = 256
#
# VERSION = 1.8.7-p330
# CMD     = ~/.multiruby/install/1.8.7-p330/bin/ruby -v -Ilib bug4.rb
#
# ruby 1.8.7 (2010-12-23 patchlevel 330) [i686-darwin10.5.0]
#
# RESULT = 0
#
# VERSION = 1.9.2-p136
# CMD     = ~/.multiruby/install/1.9.2-p136/bin/ruby -v -Ilib bug4.rb
#
# ruby 1.9.2p136 (2010-12-25 revision 30365) [x86_64-darwin10.5.0]
#
# RESULT = 0
#
# TOTAL RESULT = 1 failures out of 3



-- 
http://redmine.ruby-lang.org