[Rt-commit] r4204 - in rt/branches/3.7-EXPERIMENTAL: . lib

ruz at bestpractical.com ruz at bestpractical.com
Thu Dec 1 14:58:59 EST 2005


Author: ruz
Date: Thu Dec  1 14:58:58 2005
New Revision: 4204

Modified:
   rt/branches/3.7-EXPERIMENTAL/   (props changed)
   rt/branches/3.7-EXPERIMENTAL/lib/RT.pm.in
Log:
 r1368 at cubic-pc:  cubic | 2005-12-01 14:03:13 +0300
 SGI{__DIE__}
 * never 'exit', because it hides errors from command line scripts
 * Log error and rollback transactions only when it's possible


Modified: rt/branches/3.7-EXPERIMENTAL/lib/RT.pm.in
==============================================================================
--- rt/branches/3.7-EXPERIMENTAL/lib/RT.pm.in	(original)
+++ rt/branches/3.7-EXPERIMENTAL/lib/RT.pm.in	Thu Dec  1 14:58:58 2005
@@ -335,17 +335,13 @@
 #When we call die, trap it and log->crit with the value of the die.
 
     $SIG{__DIE__}  = sub {
+        # if we are not in eval and perl is not parsing code
+        # then rollback transactions and log RT error
         unless ($^S || !defined $^S ) {
-            $RT::Handle->Rollback();
-            $RT::Logger->crit("$_[0]");
-            # XXX: we should never exit, even if we are not in eval context
-            # could someone explane this code?
-            exit(-1);
-        }
-        else {
-            # Get out of here if we're in an eval
-            die $_[0];
+            $RT::Handle->Rollback if $RT::Handle;
+            $RT::Logger->crit("$_[0]") if $RT::Logger;
         }
+        die $_[0];
     };
 
 # }}}


More information about the Rt-commit mailing list