diff options
author | Junio C Hamano <gitster@pobox.com> | 2021-10-12 23:51:33 +0300 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2021-10-12 23:51:33 +0300 |
commit | 0e17a537f3924e4de3356bb8eef214adf2bd6541 (patch) | |
tree | e8e9477f1eb67f7d3533b6619bf2dbdb5255b239 | |
parent | 49c2cbe69aa0cb85a2c749ef853eae907d1249ba (diff) | |
parent | e8f55568de602630e0ce60f7863bdaeeea26c1c0 (diff) |
Merge branch 'jk/t5562-racefix' into maint
Test update.
* jk/t5562-racefix:
t5562: use alarm() to interrupt timed child-wait
-rw-r--r-- | t/t5562/invoke-with-content-length.pl | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/t/t5562/invoke-with-content-length.pl b/t/t5562/invoke-with-content-length.pl index 0943474af2..718dd9b49d 100644 --- a/t/t5562/invoke-with-content-length.pl +++ b/t/t5562/invoke-with-content-length.pl @@ -13,11 +13,6 @@ my $body_data; defined read($body_fh, $body_data, $body_size) or die "Cannot read $body_filename: $!"; close($body_fh); -my $exited = 0; -$SIG{"CHLD"} = sub { - $exited = 1; -}; - # write data my $pid = open(my $out, "|-", @command); { @@ -29,8 +24,13 @@ my $pid = open(my $out, "|-", @command); } print $out $body_data or die "Cannot write data: $!"; -sleep 60; # is interrupted by SIGCHLD -if (!$exited) { - close($out); +$SIG{ALRM} = sub { + kill 'KILL', $pid; die "Command did not exit after reading whole body"; +}; +alarm 60; + +my $ret = waitpid($pid, 0); +if ($ret != $pid) { + die "confusing return from waitpid: $ret"; } |