aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org>2018-04-19 15:23:49 +0300
committerSergey Poznyakoff <gray@gnu.org>2018-04-19 15:23:49 +0300
commitc7f7295dbd260099a58eefeea9594995672fd170 (patch)
tree748315bcff141bb2bfeb2df628c3b624c2e6272a
parentd21aabb64b7178667349199ff852326365899258 (diff)
downloadacmeman-c7f7295dbd260099a58eefeea9594995672fd170.tar.gz
acmeman-c7f7295dbd260099a58eefeea9594995672fd170.tar.bz2
Always report incorrect termination of a subprocess
-rwxr-xr-xacmeman29
1 files changed, 16 insertions, 13 deletions
diff --git a/acmeman b/acmeman
index 99f158a..e6fee16 100755
--- a/acmeman
+++ b/acmeman
@@ -629,2 +629,16 @@ 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");
+ }
+ }
+}
@@ -1187,13 +1201,3 @@ foreach my $vhost (@domlist) {
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 {
@@ -1208,4 +1212,3 @@ if ($renewed) {
foreach my $cmd ($config->get(qw(core postrenew))) {
- debug(1, "running $cmd");
- system($cmd) unless $dry_run;
+ runcmd($cmd);
}

Return to:

Send suggestions and report system problems to the System administrator.