[Midnightbsd-cvs] mports: Worker.pm: deal with SIGTERM too.

ctriv at midnightbsd.org ctriv at midnightbsd.org
Mon Oct 6 12:25:54 EDT 2008


Log Message:
-----------
deal with SIGTERM too.
exit with code 6 on database drop.

Modified Files:
--------------
    mports/Tools/lib/Magus/App/Slave:
        Worker.pm (r1.4 -> r1.5)

-------------- next part --------------
Index: Worker.pm
===================================================================
RCS file: /home/cvs/mports/Tools/lib/Magus/App/Slave/Worker.pm,v
retrieving revision 1.4
retrieving revision 1.5
diff -L Tools/lib/Magus/App/Slave/Worker.pm -L Tools/lib/Magus/App/Slave/Worker.pm -u -r1.4 -r1.5
--- Tools/lib/Magus/App/Slave/Worker.pm
+++ Tools/lib/Magus/App/Slave/Worker.pm
@@ -7,6 +7,7 @@
   my ($class, %args) = @_;
   
   local $SIG{CHLD} = 'DEFAULT';
+  local $SIG{TERM} = sub { die "SIGTERM\n" };
   local $SIG{INT}  = sub { die "SIGINT\n" };
   
   my $self = bless \%args, $class;
@@ -22,8 +23,11 @@
   }; 
   
   if ($@) {
-	if ($@ =~ m/DBI/ || $@ =~ m/SIGINT/) {
-		return;
+	if ($@ =~ m/DBI/) {
+	  # we want to let the parent know that we lost the DB connection.
+	  exit 6;
+	} elsif ($@ =~ m/SIGINT/ || $@ =~ /SIGTERM/) {
+	  return;
 	} 
 	
 	# we make sure we never have an uncaught exception!
@@ -33,6 +37,11 @@
 	  $self->log->err("Exception thrown building $port: $error");
 	  $port->set_result_internal("Exception thrown: $error");
         };
+        
+        if ($@ && $@ =~ m/DBI/) {
+          $self->log->err($@);
+          exit 6;
+        }
   }
 }
 


More information about the Midnightbsd-cvs mailing list