Skip to content

Commit

Permalink
Second parameter to reap() is the limit (in seconds) to wait for a child
Browse files Browse the repository at this point in the history
Defaults to 3 seconds.

Signed-off-by: Pedro Melo <melo@simplicidade.org>
  • Loading branch information
melo committed Jan 22, 2013
1 parent e61c532 commit b9d966a
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions t/tlib/Test/SpawnRedisServer.pm
Original file line number Diff line number Diff line change
Expand Up @@ -108,11 +108,12 @@ sub spawn_server {
}

sub reap {
my ($pid) = @_;
$pid = -1 unless $pid;
my ($pid, $limit) = @_;
$pid = -1 unless $pid;
$limit = 3 unless $limit;

my $try = 0;
while ($try++ < 3) {
while ($try++ < $limit) {
my $ok = waitpid($pid, WNOHANG);
$try = 0, last if $ok > 0;
sleep(1);
Expand Down

0 comments on commit b9d966a

Please sign in to comment.