develooper Front page | perl.perl5.porters | Postings from October 2003

Re: [perl@21451] t/io/openpid.t tests fail on Win32 with :stdio

Thread Previous
From:
Steve Hay
Date:
October 15, 2003 07:54
Subject:
Re: [perl@21451] t/io/openpid.t tests fail on Win32 with :stdio
Message ID:
3F8D6039.3080403@uk.radan.com
Steve Hay wrote:

> The t/io/openpid.t tests currently fail in bleadperl on Win32 with the 
> :stdio layer: 

I've reduced the problem to this test program:

=====
$| = 1;
my $cmd = qq/$^X -e "\$| = 1; print qq[hi\\n]; sleep 5;"/;
my $pid = open(FH, "$cmd |") or die "Can't open command: $!\n";
printf "%d: Opened command with PID %d\n", time, $pid;
chomp(my $data = scalar(<FH>));
printf "%d: Read '%s' from command\n", time, $data;
my $num = kill HUP => $pid;
printf "%d: Killed %d processes\n", time, $num;
=====

Under perl-5.8.1 this outputs something like:

    1066229113: Opened command with PID 1824
    1066229113: Read 'hi' from command
    1066229113: Killed 1 processes

in which all three times are the same, while under perl-current the 
output is more like:

    1066229103: Opened command with PID 3976
    1066229108: Read 'hi' from command
    1066229108: Killed 0 processes

in which the read from <FH> appears to wait for the 5sec sleep in the 
child process to complete.

Thus, under perl-current the child process has completed (exited) by the 
time the parent comes to kill it, hence the kill fails.

- Steve


Thread Previous


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About