Archived
1
0

Display important warnings on process return

This commit is contained in:
Mercier Pierre-Olivier 2013-11-13 01:12:05 +01:00
parent 4e35cabf62
commit c5a1bf8917

View File

@ -62,9 +62,9 @@ sub do_work ($$$@)
my $sax_handler = ProcessHandler->new($args);
my $parser = XML::SAX::ParserFactory->parser( Handler => $sax_handler );
my $ret;
my @retW;
eval {
$SIG{'__WARN__'} = sub { log WARN, $_[0]; $ret .= ">>> ".$_[0]."\n"; };
$SIG{'__WARN__'} = sub { log WARN, $_[0]; push @retW, $_[0]; };
$parser->parse_string(${ $_[0]{argref} });
};
@ -74,14 +74,17 @@ sub do_work ($$$@)
return $err;
}
my $ret;
eval {
$ret = $subref->($given_args, $args);
};
if ($@) {
my $err = $@;
log ERROR, $err;
return $err;
$ret = $err;
}
$ret .= ">>> ".$_."\n" foreach (@retW);
return $ret;
}