package Gruntmaster::Daemon::Runner::Verifier;

use 5.014000;
use strict;
use warnings;

use Gruntmaster::Daemon::Constants qw/WA/;
use File::Slurp qw/slurp/;
use Log::Log4perl qw/get_logger/;
use Try::Tiny;

##################################################

sub run{
  my ($test, $meta) = @_;
  get_logger->trace("Running on test $test...");
  $meta->{files}{prog}{run}->($meta->{files}{prog}{name}, fds => [qw/0 input 1 >output/], map {defined $meta->{$_} ? ($_ => $meta->{$_}) : () } qw/timeout olimit mlimit/);

  try {
	$meta->{files}{ver}{run}->($meta->{files}{ver}{name}, fds => [qw/0 input 3 output 1 >result/]);
  } catch {
	die [WA, "Wrong answer"]
  };
  scalar slurp 'result';
}

1
