summaryrefslogtreecommitdiffabout
authorSergey Poznyakoff <gray@gnu.org>2018-04-19 12:23:49 (GMT)
committer Sergey Poznyakoff <gray@gnu.org>2018-04-19 12:23:49 (GMT)
commitc7f7295dbd260099a58eefeea9594995672fd170 (patch) (side-by-side diff)
tree748315bcff141bb2bfeb2df628c3b624c2e6272a
parentd21aabb64b7178667349199ff852326365899258 (diff)
downloadacmeman-c7f7295dbd260099a58eefeea9594995672fd170.tar.gz
acmeman-c7f7295dbd260099a58eefeea9594995672fd170.tar.bz2
Always report incorrect termination of a subprocess
Diffstat (more/less context) (ignore whitespace changes)
-rwxr-xr-xacmeman29
1 files changed, 16 insertions, 13 deletions
diff --git a/acmeman b/acmeman
index 99f158a..e6fee16 100755
--- a/acmeman
+++ b/acmeman
@@ -627,6 +627,20 @@ sub prep_dir {
}
}
+sub runcmd {
+ my $cmd = shift;
+ debug(1, "running $cmd");
+ unless ($dry_run) {
+ system($cmd);
+ if ($? == -1) {
+ error("$cmd: failed to execute: $!");
+ } elsif ($? & 127) {
+ error("$cmd: died on signal ".($? & 127));
+ } elsif (my $code = ($? >> 8)) {
+ error("$cmd: exited with code $code");
+ }
+ }
+}
sub debug_to_loglevel {
my @lev = ('err', 'info', 'debug');
@@ -1185,17 +1199,7 @@ foreach my $vhost (@domlist) {
if ($force || domain_cert_expires($vhost)) {
if (register_domain_certificate($vhost)) {
if (my $cmd = $vhost->postrenew) {
- debug(1, "running $cmd");
- unless ($dry_run) {
- system($cmd);
- if ($? == -1) {
- error("$cmd: failed to execute: $!");
- } elsif ($? & 127) {
- error("$cmd: died on signal ".($? & 127));
- } elsif (my $code = ($? >> 8)) {
- error("$cmd: exited with code $code");
- }
- }
+ runcmd($cmd);
} else {
$renewed++;
}
@@ -1206,8 +1210,7 @@ foreach my $vhost (@domlist) {
if ($renewed) {
if ($config->isset(qw(core postrenew))) {
foreach my $cmd ($config->get(qw(core postrenew))) {
- debug(1, "running $cmd");
- system($cmd) unless $dry_run;
+ runcmd($cmd);
}
} else {
error("certificates changed, but no postrenew command is defined (core.postrenew)");

Return to:

Send suggestions and report system problems to the System administrator.