From: John Carter Date: 2007-05-23T11:40:30+09:00 Subject: test/unit autorun fails to set exit status on failure Consider the elementary unit test that fails... =try.rb=============================================================== require 'test/unit' class TC_OurTest < Test::Unit::TestCase def test_fail assert(false, 'Assertion was false.') end end ====================================================================== What is its exit status? ruby -w try.rb echo $? 0 If I look in /usr/local/lib/ruby/1.8/test/unit.rb I see at the end the following code... ---------------------------------------------------------------------- at_exit do unless $! || Test::Unit.run? exit Test::Unit::AutoRunner.run end end ---------------------------------------------------------------------- Now try this chunk of code... ==atexittoolate.rb==================================================== at_exit do exit( 1) end ====================================================================== ruby -w atexittoolate.rb;echo $? 0 If I change that to... ==atexittoolate.rb==================================================== at_exit do exit( 1) end exit(2) ====================================================================== ruby -w atexittoolate.rb;echo $? 2 Bottom line: at_exit seems to be too late (Under ruby-1.8.6 linux anyway) to set the exit status. John Carter Phone : (64)(3) 358 6639 Tait Electronics Fax : (64)(3) 359 4632 PO Box 1645 Christchurch Email : john.carter@tait.co.nz New Zealand