From: Marius Gavrilescu Date: Tue, 28 Jan 2014 09:34:25 +0000 (+0200) Subject: Save compile errors X-Git-Tag: 5999.000_001~29 X-Git-Url: http://git.ieval.ro/?a=commitdiff_plain;h=22e9a940bf1efad4f2f27da94eba52b8aa96b54f;p=gruntmaster-daemon.git Save compile errors --- diff --git a/lib/Gruntmaster/Daemon.pm b/lib/Gruntmaster/Daemon.pm index ed8e405..73610b3 100644 --- a/lib/Gruntmaster/Daemon.pm +++ b/lib/Gruntmaster/Daemon.pm @@ -43,15 +43,12 @@ sub safe_can { sub prepare{ my ($name, $format) = @_; + our $errors; my $basename = fileparse $name, qr/\.[^.]*/; get_logger->trace("Preparing file $name..."); - open my $devnull, devnull; - open my $errors, '>>compile-error'; - my $ret = open3 $devnull, $errors, undef, 'gruntmaster-compile', $format => $basename, $name; - waitpid $ret, 0; - close $devnull; - close $errors; + $errors .= `gruntmaster-compile $format $basename $name 2>&1`; + $errors .= "\n"; die 'Compile error' if $? } @@ -73,6 +70,7 @@ sub process{ my @results; my @full_results = (); my $meta = {}; + our $errors = ''; try { $meta = job_inmeta $job; if (job_problem $job) { @@ -83,6 +81,7 @@ sub process{ } prepare_files $meta; + chomp $errors; my ($files, $generator, $runner, $judge, $testcnt) = map { $meta->{$_} or die "Required parameter missing: $_"} qw/files generator runner judge testcnt/; @@ -128,6 +127,7 @@ sub process{ set_job_result $job, $meta->{result}; set_job_result_text $job, $meta->{result_text}; set_job_results $job, \@full_results if scalar @full_results; + set_job_errors $job, $errors; my $log = $meta->{contest} ? "ct/$meta->{contest}/log" : 'log'; PUBLISH gensrc => $job;