@@ -23,28 +23,38 @@ watchdog(15, $^O eq 'MSWin32' ? "alarm" : '');
23
23
use Config;
24
24
$| = 1;
25
25
$SIG {PIPE } = ' IGNORE' ;
26
+ # reset the handler in case the shell has set a broken default
27
+ $SIG {HUP } = ' DEFAULT' ;
26
28
$SIG {HUP } = ' IGNORE' if $^O eq ' interix' ;
27
29
28
30
my $perl = which_perl();
29
31
$perl .= qq[ "-I../lib"] ;
30
32
33
+ my @perl = ( which_perl(), " -I../lib" );
34
+
31
35
#
32
36
# commands run 4 perl programs. Two of these programs write a
33
37
# short message to STDOUT and exit. Two of these programs
34
38
# read from STDIN. One reader never exits and must be killed.
35
39
# the other reader reads one line, waits a few seconds and then
36
40
# exits to test the waitpid function.
37
41
#
38
- $cmd1 = qq/ $perl -e "\$ |=1; print qq[first process\\ n]; sleep 30;"/ ;
39
- $cmd2 = qq/ $perl -e "\$ |=1; print qq[second process\\ n]; sleep 30;"/ ;
42
+ # Using 4+ arg open for the children that sleep so that that we're
43
+ # killing the perl process instead of an intermediate shell, this
44
+ # allows harness to see the file handles closed sooner. I didn't
45
+ # convert them all since I wanted 3-arg open to continue to be
46
+ # exercised here.
47
+ #
48
+ @cmd1 = ( @perl , " -e" , " \$ |=1; print qq[first process\\ n]; sleep 30;" );
49
+ @cmd2 = ( @perl , " -e" , " \$ |=1; print qq[second process\\ n]; sleep 30;" );
40
50
$cmd3 = qq/ $perl -e "print <>;"/ ; # hangs waiting for end of STDIN
41
51
$cmd4 = qq/ $perl -e "print scalar <>;"/ ;
42
52
43
- # warn "#$ cmd1\n#$ cmd2\n#$cmd3\n#$cmd4\n";
53
+ # warn "#@ cmd1\n#@ cmd2\n#$cmd3\n#$cmd4\n";
44
54
45
55
# start the processes
46
- ok( $pid1 = open (FH1, " $cmd1 | " ), ' first process started' );
47
- ok( $pid2 = open (FH2, " $cmd2 | " ), ' second' );
56
+ ok( $pid1 = open (FH1, " -| " , @cmd1 ), ' first process started' );
57
+ ok( $pid2 = open (FH2, " -| " , @cmd2 ), ' second' );
48
58
{
49
59
no warnings ' once' ;
50
60
ok( $pid3 = open (FH3, " | $cmd3 " ), ' third' );
0 commit comments