in reply to Select on child output problem
What happens if you use eof on the current filehandle? You want to exhaust everything you can read without blocking, right? (You can control that the children always send a newline to terminate each line too.)
Something like this might get you further:
while (!eof( $fd )) { chomp( my $data = <$fd> ); if ($data) { push @results, [ split ":", $data ]; } else { # Other side (child) has closed connection. $file_iter->remove($_); close $fd; # Closing fd cleans up child } } sleep 10;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Select on child output problem
by topher (Scribe) on May 03, 2012 at 02:31 UTC |