It would be a lot more useful, I think, if rake detected a SystemExit
and then exited with the status in the exception, rather than just doing
an exit(1).

Specifically, I'm doing an early exit in one of my rake tasks where I
need to return a 0 exit code. Rake intercepts this SystemExit and always
returns a 1, regardless of the status.

The patch for this is trivial, and included.

-- 
Stephen Touset <[EMAIL PROTECTED]>
--- /var/lib/gems/1.8/gems/rake-0.7.3/lib/rake.rb	2007-04-25 15:45:50.000000000 -0400
+++ /home/stouset/rake.rb	2007-05-21 19:14:34.000000000 -0400
@@ -1759,7 +1759,10 @@
     def standard_exception_handling
       begin
         yield
-      rescue SystemExit, GetoptLong::InvalidOption => ex
+      rescue SystemExit => ex
+        # Exit with returned status
+        exit(ex.status)
+      rescue GetoptLong::InvalidOption
         # Exit silently
         exit(1)
       rescue Exception => ex

Attachment: signature.asc
Description: This is a digitally signed message part

_______________________________________________
Rake-devel mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/rake-devel

Reply via email to