Permalink
Browse files

rake now returns status codes from explicit exits.

git-svn-id: svn+ssh://rubyforge.org/var/svn/rake/trunk@592 5af023f1-ac1a-0410-98d6-829a145c37ef
  • Loading branch information...
1 parent d1f89d7 commit 26fba88ea725e391bbed9532568c6121e6ded8bc jimweirich committed May 27, 2007
Showing with 23 additions and 1 deletion.
  1. +4 −0 CHANGES
  2. +3 −0 lib/rake.rb
  3. +1 −1 test/functional.rb
  4. +15 −0 test/session_functional.rb
View
@@ -7,6 +7,10 @@
* The 'desc' command will now document task argument names.
* Comments are limited to 80 columns or so (suggested by Jamis Buck).
* Added -D to display full comments (suggested by Jamis Buck).
+* The rake program will set the status value used in any explicit
+ exit(n) calls. (patch provided by Stephen Touset)
+* Fixed error in functional tests that were not including session (and
+ silently skipping the functionl tests.
== Version 0.7.3
View
@@ -1873,6 +1873,9 @@ def parse_task_string(string)
def standard_exception_handling
begin
yield
+ rescue SystemExit => ex
+ # Exit silently with current status
+ exit(ex.status)
rescue SystemExit, GetoptLong::InvalidOption => ex
# Exit silently
exit(1)
View
@@ -2,7 +2,7 @@
begin
require 'rubygems'
- gem 'session'
+ require 'session'
rescue LoadError
puts "UNABLE TO RUN FUNCTIONAL TESTS"
puts "No Session Found"
View
@@ -2,6 +2,7 @@
require 'test/unit'
require 'fileutils'
+require 'session'
# Version 2.1.9 of session has a bug where the @debug instance
# variable is not initialized, causing warning messages. This snippet
@@ -188,6 +189,20 @@ def test_file_task_are_not_scoped_by_namespaces
assert_match(/^XYZ1\nXYZ2$/m, @out)
end
end
+
+ def test_rake_returns_status_error_values
+ Dir.chdir("test/data/statusreturn") do
+ rake "exit5"
+ assert_status(5)
+ end
+ end
+
+ def test_rake_returns_no_status_error_on_normal_exit
+ Dir.chdir("test/data/statusreturn") do
+ rake "normal"
+ assert_status(0)
+ end
+ end
private

0 comments on commit 26fba88

Please sign in to comment.