aboutsummaryrefslogtreecommitdiffstats
path: root/lib/MGA/Advisories.pm
diff options
context:
space:
mode:
Diffstat (limited to 'lib/MGA/Advisories.pm')
-rw-r--r--lib/MGA/Advisories.pm11
1 files changed, 10 insertions, 1 deletions
diff --git a/lib/MGA/Advisories.pm b/lib/MGA/Advisories.pm
index dbb7408..4663eb6 100644
--- a/lib/MGA/Advisories.pm
+++ b/lib/MGA/Advisories.pm
@@ -621,6 +621,14 @@ sub process_template {
# Max 10 processes for processing templates
my $pm = Parallel::ForkManager->new(10);
+$pm->run_on_finish(\&parallel_finish);
+my $parallelerror = 0;
+
+# Store error flag from forked process
+sub parallel_finish {
+ my ($pid, $exit_code, $ident) = @_;
+ $parallelerror |= $exit_code;
+}
# Run process_template in its own process. The process creation overhead is
# high, so this only makes sense for templates that interate over all or most
@@ -633,9 +641,10 @@ sub parallel_process_template {
}
}
-# Wait for all processes to finish
+# Wait for all processes to finish & die if any returned an error
sub parallel_complete {
$pm->wait_all_children;
+ die "Error writing output" if $parallelerror;
}
sub output_pages {