X-Git-Url: http://git.ieval.ro/?p=gruntmaster-daemon.git;a=blobdiff_plain;f=lib%2FGruntmaster%2FDaemon%2FRunner%2FInteractive.pm;h=1825fcdfa384bb3132afa7189b03e0c7983d7076;hp=9118e154960cfc5d35a548576b51335fdc2d844d;hb=fdb99417bb13ca0418a5ec8d9e240e29565225c4;hpb=7be8c37d42b6782bc5d94ea4e52dd1261ce6e3ae diff --git a/lib/Gruntmaster/Daemon/Runner/Interactive.pm b/lib/Gruntmaster/Daemon/Runner/Interactive.pm index 9118e15..1825fcd 100644 --- a/lib/Gruntmaster/Daemon/Runner/Interactive.pm +++ b/lib/Gruntmaster/Daemon/Runner/Interactive.pm @@ -21,10 +21,16 @@ sub run{ mkfifo 'fifo1', 0600 or die $! unless -e 'fifo1'; mkfifo 'fifo2', 0600 or die $! unless -e 'fifo2'; + if ($test == 1 && $ENV{GRUNTMASTER_VM}) { + exec 'cat ver.in' if fork; + exec 'cat prog.in' if fork; + } + my $ret = fork // get_logger->logdie("Fork failed: $!"); if ($ret) { try { - $meta->{files}{prog}{run}->($meta->{files}{prog}{name}, fds => [qw/0 fifo1 1 >fifo2/], map {defined $meta->{$_} ? ($_ => $meta->{$_}) : () } qw/timeout mlimit/); + my @fds = $ENV{GRUNTMASTER_VM} ? qw,0 /dev/ttyS1 1 >/dev/ttyS1, : qw/0 fifo1 1 >fifo2/; + $meta->{files}{prog}{run}->($meta->{files}{prog}{name}, fds => \@fds, map {defined $meta->{$_} ? ($_ => $meta->{$_}) : () } qw/timeout mlimit/); } catch { die $_ } finally { @@ -33,7 +39,8 @@ sub run{ die [WA, "Wrong Answer"] if $?; } else { try { - $meta->{files}{ver}{run}->($meta->{files}{ver}{name}, fds => [qw/1 >fifo1 0 fifo2 4 >result/], args => [$test], map {defined $meta->{$_} ? ($_ => $meta->{$_}) : () } qw/timeout mlimit/); + my @fds = $ENV{GRUNTMASTER_VM} ? qw,1 >/dev/ttyS1 0 /dev/ttyS1, : qw/1 >fifo1 0 fifo2/; + $meta->{files}{ver}{run}->($meta->{files}{ver}{name}, fds => [@fds, qw,4 >result,], args => [$test], map {defined $meta->{$_} ? ($_ => $meta->{$_}) : () } qw/timeout mlimit/); } catch { exit 1; };