aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThierry Vignaud <tv@mageia.org>2012-03-25 23:29:16 +0000
committerThierry Vignaud <tv@mageia.org>2012-03-25 23:29:16 +0000
commit34eb26654758083243b236448de28cd6a4368044 (patch)
tree5299150c2adff9bbb4f2a68cc8c3fcec13f1c10e
parent004f1dc09b243c2b009145c99247d2741a2668a7 (diff)
downloadiurt-34eb26654758083243b236448de28cd6a4368044.tar
iurt-34eb26654758083243b236448de28cd6a4368044.tar.gz
iurt-34eb26654758083243b236448de28cd6a4368044.tar.bz2
iurt-34eb26654758083243b236448de28cd6a4368044.tar.xz
iurt-34eb26654758083243b236448de28cd6a4368044.zip
add a couple comments
-rw-r--r--lib/Iurt/Process.pm6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/Iurt/Process.pm b/lib/Iurt/Process.pm
index d1292ca..29c8d4f 100644
--- a/lib/Iurt/Process.pm
+++ b/lib/Iurt/Process.pm
@@ -97,6 +97,7 @@ sub fork_to_monitor {
if (!$pid) {
plog('DEBUG', "Forking to monitor log size");
$run->{main} = 0;
+ # So that we don't get killed by alarm set by parent:
local $SIG{ALRM} = sub { exit() };
$tot_time += sleep 30;
my $size_limit = $config->{log_size_limit};
@@ -262,6 +263,7 @@ sub perform_command {
}
eval {
+ # handle timeout:
local $SIG{ALRM} = sub {
print "Timeout!\n";
$kill = 1;
@@ -270,6 +272,7 @@ sub perform_command {
alarm $opt{timeout};
+ # actually execute it:
if ($opt{type} eq 'perl') {
plog('DEBUG', "perl command");
$command->[0](@{$command->[1]});
@@ -282,6 +285,7 @@ sub perform_command {
$output = `$command 2>&1`;
}
}
+ # completed before timeout, disable it:
alarm 0;
};
@@ -292,6 +296,8 @@ sub perform_command {
# <mrl> Log it before any changes on it.
plog('DEBUG', "Command exited with $err.");
+
+ # some errors might be OK:
$err = 0 if any { $_ == $err } @{$opt{error_ok}};
# kill pid watching log file size