From 66114cef360914d5897be1ef0751a7716b07104f Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jan=20Kr=C3=BCger?= Date: Fri, 5 Nov 2010 06:40:56 +0100 Subject: [PATCH] jobd: remember to mark finished jobs as finished MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Hurrrrr. Gurrrrrk. Signed-off-by: Jan Krüger --- jobd/jobd.pl | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/jobd/jobd.pl b/jobd/jobd.pl index 7230101..db42860 100755 --- a/jobd/jobd.pl +++ b/jobd/jobd.pl @@ -189,7 +189,7 @@ sub reap_finished_jobs { my $pid; while (1) { $pid = waitpid(-1, WNOHANG); - last if $pid == -1; + last if $pid < 1; my @child = grep { $_->{'pid'} && $_->{'pid'} == $pid } @running; if ($?) { @@ -197,6 +197,7 @@ sub reap_finished_jobs { } if (@child && !$child[0]->{'finished'}) { $child[0]->{'on_success'}->($_) if defined($child[0]->{'on_success'}); + $child[0]->{'finished'} = 1; $jobs_executed++; } elsif (@child) { $child[0]->{'on_error'}->($_) if defined($child[0]->{'on_error'}); -- 2.11.4.GIT