summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org>2019-05-26 11:09:26 +0300
committerSergey Poznyakoff <gray@gnu.org>2019-05-26 11:11:31 +0300
commit9880a949d2f1e1783302f4f6e25a4729d8761d5e (patch)
tree987860172e766d2c43ec42086ff4a76f0a461e80
parentf12defd06dfab84dd5a6a1d6f9839d6bb3af2c62 (diff)
downloadconfig-haproxy-9880a949d2f1e1783302f4f6e25a4729d8761d5e.tar.gz
config-haproxy-9880a949d2f1e1783302f4f6e25a4729d8761d5e.tar.bz2
Fix improper use of IPC::Cmd->run
-rw-r--r--lib/Config/HAProxy.pm14
1 files changed, 8 insertions, 6 deletions
diff --git a/lib/Config/HAProxy.pm b/lib/Config/HAProxy.pm
index 794a80f..44cc3fb 100644
--- a/lib/Config/HAProxy.pm
+++ b/lib/Config/HAProxy.pm
@@ -13,10 +13,10 @@ use File::Basename;
13use File::Temp qw(tempfile); 13use File::Temp qw(tempfile);
14use File::stat; 14use File::stat;
15use File::Spec; 15use File::Spec;
16use IPC::Cmd; 16use IPC::Cmd qw(run);
17use Carp; 17use Carp;
18 18
19our $VERSION = '1.03'; 19our $VERSION = '1.04';
20 20
21my %sections = ( 21my %sections = (
22 global => 1, 22 global => 1,
@@ -231,12 +231,14 @@ sub save {
231 DIR => dirname($self->filename)); 231 DIR => dirname($self->filename));
232 $self->write($fh, @wrargs); 232 $self->write($fh, @wrargs);
233 close($fh); 233 close($fh);
234
235 if (my $cmd = $self->lint) { 234 if (my $cmd = $self->lint) {
236 my ($ok, $err, undef, undef, $errbuf) = 235 my ($ok, $err, $full, $outbuf, $errbuf) =
237 IPC::Cmd->run(command => "$cmd $tempfile"); 236 run(command => "$cmd $tempfile");
238 unless ($ok) { 237 unless ($ok) {
239 croak "Syntax check failed: $errbuf\n"; 238 if ($errbuf && @$errbuf) {
239 croak "Syntax check failed: ".join("\n", @$errbuf)."\n";
240 }
241 croak $err;
240 } 242 }
241 } 243 }
242 return 1 if $dry_run; 244 return 1 if $dry_run;

Return to:

Send suggestions and report system problems to the System administrator.