testworker: handle EAGAIN

Hopefully this fixes the case where a testworker would die and leave the
whole testsuite run hanging in the air, never completing.
This commit is contained in:
Michael Stapelberg 2012-08-12 00:22:17 +02:00
parent d92626bc62
commit ae88accf6f
1 changed files with 8 additions and 1 deletions

View File

@ -8,6 +8,8 @@ use IO::Handle; # for ->autoflush
use POSIX ();
use Errno qw(EAGAIN);
use Exporter 'import';
our @EXPORT = qw(worker worker_next);
@ -74,7 +76,12 @@ sub worker_wait {
my $ipc = $self->{ipc};
my $ipc_fd = fileno($ipc);
while (defined(my $file = $ipc->getline)) {
while (1) {
my $file = $ipc->getline;
if (!defined($file)) {
next if $! == EAGAIN;
last;
}
chomp $file;
exit unless $file;