From 1810a1354696f081906c27f3797a6bf5cae4647c Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Thu, 27 Nov 2008 19:06:11 +0000 Subject: [PATCH] --- src/Hydra/programs/Runner.pl | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/src/Hydra/programs/Runner.pl b/src/Hydra/programs/Runner.pl index e804a80f..f20e909b 100644 --- a/src/Hydra/programs/Runner.pl +++ b/src/Hydra/programs/Runner.pl @@ -27,12 +27,6 @@ $db->txn_do(sub { }); -sub logfileForBuild { - my ($id) = @_; - return getcwd . "/logs/" . $id; -} - - sub checkJobs { print "looking for runnable jobs...\n"; @@ -72,7 +66,8 @@ sub checkJobs { "starting ", scalar(@jobs), " builds\n"; foreach my $job (@jobs) { - unlink(logfileForBuild $job->id); + my $logfile = getcwd . "/logs/" . $job->id; + unlink($logfile); $job->schedulingInfo->busy(1); $job->schedulingInfo->locker($$); $job->schedulingInfo->logfile($logfile); @@ -90,10 +85,10 @@ sub checkJobs { my $id = $job->id; print "starting job $id (", $job->project->name, ":", $job->attrname, ") on ", $job->system, "\n"; eval { + my $logfile = $job->schedulingInfo->logfile; my $child = fork(); die unless defined $child; if ($child == 0) { - my $logfile = logfileForBuild $job->id; open LOG, ">$logfile" or die; POSIX::dup2(fileno(LOG), 1) or die; POSIX::dup2(fileno(LOG), 2) or die;