This commit is contained in:
Eelco Dolstra 2008-11-27 18:54:25 +00:00
parent d6f71f2248
commit ac89e7d4ed

View file

@ -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;