In perl.git, the branch blead has been updated

<https://perl5.git.perl.org/perl.git/commitdiff/b6811f8d3a5c4826ad03be7b9dc69f5f3dc939be?hp=aed76e69bd9a87baa8ab250f3e953beb2779f66e>

- Log -----------------------------------------------------------------
commit b6811f8d3a5c4826ad03be7b9dc69f5f3dc939be
Author: Tony Cook <t...@develop-help.com>
Date:   Tue Jan 28 15:52:22 2014 +1100

    [perl #121028] avoid creating a shell process
    
    Win32 now has list form open, so this can now be supplied.

-----------------------------------------------------------------------

Summary of changes:
 t/io/openpid.t | 20 +++++++++++++++-----
 1 file changed, 15 insertions(+), 5 deletions(-)

diff --git a/t/io/openpid.t b/t/io/openpid.t
index d3fcf7869a..634330ded7 100644
--- a/t/io/openpid.t
+++ b/t/io/openpid.t
@@ -23,11 +23,15 @@ watchdog(15, $^O eq 'MSWin32' ? "alarm" : '');
 use Config;
 $| = 1;
 $SIG{PIPE} = 'IGNORE';
+# reset the handler in case the shell has set a broken default
+$SIG{HUP} = 'DEFAULT';
 $SIG{HUP} = 'IGNORE' if $^O eq 'interix';
 
 my $perl = which_perl();
 $perl .= qq[ "-I../lib"];
 
+my @perl = ( which_perl(), "-I../lib" );
+
 #
 # commands run 4 perl programs.  Two of these programs write a
 # short message to STDOUT and exit.  Two of these programs
@@ -35,16 +39,22 @@ $perl .= qq[ "-I../lib"];
 # the other reader reads one line, waits a few seconds and then
 # exits to test the waitpid function.
 #
-$cmd1 = qq/$perl -e "\$|=1; print qq[first process\\n]; sleep 30;"/;
-$cmd2 = qq/$perl -e "\$|=1; print qq[second process\\n]; sleep 30;"/;
+# Using 4+ arg open for the children that sleep so that that we're
+# killing the perl process instead of an intermediate shell, this
+# allows harness to see the file handles closed sooner.  I didn't
+# convert them all since I wanted 3-arg open to continue to be
+# exercised here.
+#
+@cmd1 = ( @perl, "-e", "\$|=1; print qq[first process\\n]; sleep 30;" );
+@cmd2 = ( @perl, "-e", "\$|=1; print qq[second process\\n]; sleep 30;" );
 $cmd3 = qq/$perl -e "print <>;"/; # hangs waiting for end of STDIN
 $cmd4 = qq/$perl -e "print scalar <>;"/;
 
-#warn "#$cmd1\n#$cmd2\n#$cmd3\n#$cmd4\n";
+#warn "#@cmd1\n#@cmd2\n#$cmd3\n#$cmd4\n";
 
 # start the processes
-ok( $pid1 = open(FH1, "$cmd1 |"), 'first process started');
-ok( $pid2 = open(FH2, "$cmd2 |"), '    second' );
+ok( $pid1 = open(FH1, "-|", @cmd1), 'first process started');
+ok( $pid2 = open(FH2, "-|", @cmd2), '    second' );
 {
     no warnings 'once';
     ok( $pid3 = open(FH3, "| $cmd3"), '    third'  );

-- 
Perl5 Master Repository

Reply via email to