]> iEval git - gruntmaster-daemon.git/commitdiff
Avoid zombies on TLE in interactive problems
authorMarius Gavrilescu <marius@ieval.ro>
Mon, 21 Apr 2014 18:04:58 +0000 (21:04 +0300)
committerMarius Gavrilescu <marius@ieval.ro>
Mon, 21 Apr 2014 21:07:38 +0000 (00:07 +0300)
lib/Gruntmaster/Daemon/Runner/Interactive.pm

index 115e7a198ac577b0d4cc555ca9fdfe3f1a8b8346..5a986754c8b6451471c91d0957f4bb1a6a787114 100644 (file)
@@ -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 {
This page took 0.018401 seconds and 4 git commands to generate.