List:Commits« Previous MessageNext Message »
From:msvensson Date:January 10 2008 11:01am
Subject:bk commit into 5.1 tree (msvensson:1.2681)
View as plain text  
Below is the list of changes that have just been committed into a local
5.1 repository of msvensson. When msvensson does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html

ChangeSet@stripped, 2008-01-10 12:00:56+01:00, msvensson@stripped +1 -0
  Auto kill any children before exiting from process

  mysql-test/lib/My/SafeProcess.pm@stripped, 2008-01-10 12:00:54+01:00, msvensson@stripped +20 -0
    Auto kill any children before exiting from process

diff -Nrup a/mysql-test/lib/My/SafeProcess.pm b/mysql-test/lib/My/SafeProcess.pm
--- a/mysql-test/lib/My/SafeProcess.pm	2007-12-19 12:58:02 +01:00
+++ b/mysql-test/lib/My/SafeProcess.pm	2008-01-10 12:00:54 +01:00
@@ -85,6 +85,24 @@ BEGIN {
   }
 }
 
+END {
+  # Kill any children still running
+  for my $proc (values %running){
+    if ( $proc->is_child($$) ){
+      print "Killing: $proc\n";
+      $proc->kill();
+    }
+  }
+}
+
+
+sub is_child {
+  my ($self, $parent_pid)= @_;
+  die "usage: \$safe_proc->is_child()" unless (@_ == 2 and ref $self);
+  return ($self->{PARENT} == $parent_pid);
+}
+
+
 # Find the safe process binary or script
 my @safe_process_cmd;
 my $safe_kill;
@@ -172,6 +190,7 @@ sub new {
       SAFE_WINPID  => $winpid,
       SAFE_NAME => $name,
       SAFE_SHUTDOWN => $shutdown,
+      PARENT => $$,
      }, $class);
 
   # Put the new process in list of running
@@ -203,6 +222,7 @@ sub timer {
       ({
 	SAFE_PID  => $pid,
 	SAFE_NAME => "timer",
+	PARENT => $$,
        }, $class);
 
     # Put the new process in list of running
Thread
bk commit into 5.1 tree (msvensson:1.2681)msvensson10 Jan