From ac89e7d4edbe6ec0153917d594220dd4aa448a60 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Thu, 27 Nov 2008 18:54:25 +0000 Subject: [PATCH] --- src/Hydra/programs/Runner.pl | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/Hydra/programs/Runner.pl b/src/Hydra/programs/Runner.pl index f7d8d56c..e804a80f 100644 --- a/src/Hydra/programs/Runner.pl +++ b/src/Hydra/programs/Runner.pl @@ -27,11 +27,16 @@ $db->txn_do(sub { }); +sub logfileForBuild { + my ($id) = @_; + return getcwd . "/logs/" . $id; +} + + sub checkJobs { print "looking for runnable jobs...\n"; my @jobsStarted; - my $logfile; $db->txn_do(sub { @@ -67,8 +72,7 @@ sub checkJobs { "starting ", scalar(@jobs), " builds\n"; foreach my $job (@jobs) { - $logfile = getcwd . "/logs/" . $job->id; - unlink $logfile; + unlink(logfileForBuild $job->id); $job->schedulingInfo->busy(1); $job->schedulingInfo->locker($$); $job->schedulingInfo->logfile($logfile); @@ -89,6 +93,7 @@ sub checkJobs { 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;