From: Marius Gavrilescu Date: Mon, 21 Apr 2014 18:04:58 +0000 (+0300) Subject: Avoid zombies on TLE in interactive problems X-Git-Tag: 5999.000_003~9 X-Git-Url: http://git.ieval.ro/?a=commitdiff_plain;h=c020b922b2b04878b04b8d7e84079087f1dc2abc;p=gruntmaster-daemon.git Avoid zombies on TLE in interactive problems --- diff --git a/lib/Gruntmaster/Daemon/Runner/Interactive.pm b/lib/Gruntmaster/Daemon/Runner/Interactive.pm index 115e7a1..5a98675 100644 --- a/lib/Gruntmaster/Daemon/Runner/Interactive.pm +++ b/lib/Gruntmaster/Daemon/Runner/Interactive.pm @@ -23,8 +23,13 @@ sub run{ my $ret = fork // get_logger->logdie("Fork failed: $!"); if ($ret) { - $meta->{files}{prog}{run}->($meta->{files}{prog}{name}, fds => [qw/0 fifo1 1 >fifo2/], map {defined $meta->{$_} ? ($_ => $meta->{$_}) : () } qw/timeout mlimit/); - waitpid $ret, 0; + try { + $meta->{files}{prog}{run}->($meta->{files}{prog}{name}, fds => [qw/0 fifo1 1 >fifo2/], map {defined $meta->{$_} ? ($_ => $meta->{$_}) : () } qw/timeout mlimit/); + } catch { + die $_ + } finally { + waitpid $ret, 0; + }; die [WA, "Wrong Answer"] if $?; } else { try {