my $ret = fork // die 'Cannot fork';
if ($ret) {
- my $tle;
+ my ($tle, $child_ready);
+ local $SIG{USR1} = sub { $child_ready = 1 };
+ sleep 3; # Wait for ready signal (SIGUSR1)
+ unless ($child_ready) {
+ kill KILL => $ret;
+ exit !say ERR, "\nNo response from gruntmaster-exec child";
+ }
local $SIG{ALRM} = sub {
if ($killuser) {
system @sudo, 'pkill', '-KILL', '-u', $killuser;
my $signame = sig_name $sig;
exit !say TLE, "\nTime Limit Exceeded" if $tle;
exit !say OLE, "\nOutput Limit Exceeded" if $sig && $signame eq 'XFSZ';
- exit !say DIED, "\nCrash (SIG$signame)" if $sig && $signame ne 'PIPE';
+ exit !say DIED, "\nCrash (SIG$signame)" if $sig && ($signame ne 'PIPE' || $ARGV[0] !~ /prog/);
exit !say NZX, "\nNon-zero exit status: " . ($? >> 8) if $? >> 8;
exit !say AC, "\nAll OK";
} else {
print $adj 900;
close $adj;
unshift @ARGV, @sudo;
+ kill USR1 => getppid; # Tell parent process that we're ready
say STDERR "Executing: ", join ' ', map { "'$_'" } @ARGV if $debug;
exec @ARGV;
}