[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index][Thread Index][Top&Search][Original]

[PATCH - revised] watchdog should not execute END block



> The watchdog() function should not execute the END block added by
> test.pl when it forks a process.

Patch enhanced to also use the which_perl() where appropriate.
--- perl-current/t/test.pl
+++ perl-current/t/test.pl
@@ -423,7 +423,10 @@
 
 sub _create_runperl { # Create the string to qx in runperl().
     my %args = @_;
-    my $runperl = $^X =~ m/\s/ ? qq{"$^X"} : $^X;
+    my $runperl = which_perl();
+    if ($runperl =~ m/\s/) {
+        $runperl = qq{"$runperl"};
+    }
     #- this allows, for example, to set PERL_RUNPERL_DEBUG=/usr/bin/valgrind
     if ($ENV{PERL_RUNPERL_DEBUG}) {
 	$runperl = "$ENV{PERL_RUNPERL_DEBUG} $runperl";
@@ -476,14 +479,14 @@
 	$args{stdin} =~ s/\r/\\r/g;
 
 	if ($is_mswin || $is_netware || $is_vms) {
-	    $runperl = qq{$^X -e "print qq(} .
+	    $runperl = qq{$Perl -e "print qq(} .
 		$args{stdin} . q{)" | } . $runperl;
 	}
 	elsif ($is_macos) {
 	    # MacOS can only do two processes under MPW at once;
 	    # the test itself is one; we can't do two more, so
 	    # write to temp file
-	    my $stdin = qq{$^X -e 'print qq(} . $args{stdin} . qq{)' > teststdin; };
+	    my $stdin = qq{$Perl -e 'print qq(} . $args{stdin} . qq{)' > teststdin; };
 	    if ($args{verbose}) {
 		my $stdindisplay = $stdin;
 		$stdindisplay =~ s/\n/\n\#/g;
@@ -493,7 +496,7 @@
 	    $runperl .= q{ < teststdin };
 	}
 	else {
-	    $runperl = qq{$^X -e 'print qq(} .
+	    $runperl = qq{$Perl -e 'print qq(} .
 		$args{stdin} . q{)' | } . $runperl;
 	}
     }
@@ -807,8 +810,9 @@
         my $watchdog;
         eval {
             local $SIG{'__WARN__'} = sub {};
-            $watchdog = system(1, $^X, '-e', "sleep($timeout);" .
-                                             "kill('KILL', $pid_to_kill);");
+            $watchdog = system(1, which_perl(), '-e',
+                                                "sleep($timeout);" .
+                                                "kill('KILL', $pid_to_kill);");
         };
 
         # If the above worked, add END block to parent
@@ -845,6 +849,9 @@
             kill('KILL', $pid_to_kill);
         }
 
+        # Don't execute END block (added at beginning of this file)
+        $NO_ENDING = 1;
+
         # Terminate ourself (i.e., the watchdog)
         POSIX::_exit(1) if (defined(&POSIX::_exit));
         exit(1);

Follow-Ups from:
"Jerry D. Hedden" <jdhedden@cpan.org>

[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index][Thread Index][Top&Search][Original]