in reply to Re: Inexplicable ECHILD
in thread Inexplicable ECHILD

That's not true. Even if he did it properly (say by adding next if @ready; before the first die), he'd see the same behaviour. waitpid unavoidably overwrites $!=EINTR with $!=ECHLD between the time select reports an error and the program checks the cause of the error.
... use Errno qw( EINTR ); sub reaper { local ($!,$^E,$@); 1 while waitpid -1,&POSIX::WNOHANG != -1; $SIG{CHLD} = \&reaper; } $SIG{CHLD} = \&reaper; ... while (1) { my @ready = $select->can_read(); if (!@ready) { next if $! == EINTR; die "select: $!"; } handle($_) foreach @ready; }

Update: Added code.