From eb235387ae623507ca8a3549b3c433b47ad357d3 Mon Sep 17 00:00:00 2001 From: Bjorn Munch Date: Tue, 16 Mar 2010 10:45:32 +0100 Subject: Bug #51767 Implement --start-and-exit also for MTR v2 Added option and logic, bypass safe_process Adapted after review comments --- mysql-test/lib/My/SafeProcess.pm | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'mysql-test/lib/My/SafeProcess.pm') diff --git a/mysql-test/lib/My/SafeProcess.pm b/mysql-test/lib/My/SafeProcess.pm index bfcad910a16..a4ae988ed9e 100644 --- a/mysql-test/lib/My/SafeProcess.pm +++ b/mysql-test/lib/My/SafeProcess.pm @@ -60,11 +60,12 @@ use My::Platform; my %running; my $_verbose= 0; +my $start_exit= 0; END { # Kill any children still running for my $proc (values %running){ - if ( $proc->is_child($$) ){ + if ( $proc->is_child($$) and ! $start_exit){ #print "Killing: $proc\n"; if ($proc->wait_one(0)){ $proc->kill(); @@ -149,6 +150,11 @@ sub new { push(@safe_args, "--"); push(@safe_args, $path); # The program safe_process should execute + + if ($start_exit) { # Bypass safe_process instead, start program directly + @safe_args= (); + $safe_path= $path; + } push(@safe_args, @$$args); print "### safe_path: ", $safe_path, " ", join(" ", @safe_args), "\n" @@ -528,6 +534,13 @@ sub wait_all { } } +# +# Set global flag to tell all safe_process to exit after starting child +# + +sub start_exit { + $start_exit= 1; +} # # Check if any process has exited, but don't wait. -- cgit v1.2.1