Do not attempt to report dir for grab command failure if not specified.

This commit is contained in:
Kevin Quick 2019-03-17 23:15:24 -07:00
parent e523e8a643
commit 2e225ba7c8
No known key found for this signature in database
GPG key ID: E6D7733599CC0A21

View file

@ -425,7 +425,13 @@ sub run {
sub grab {
my (%args) = @_;
my $res = run(%args, grabStderr => 0);
die "command `@{$args{cmd}}' failed with exit status $res->{status} in $args{dir}" if $res->{status};
if ($res->{status}) {
my $msgloc = "(in an indeterminate location)";
if (defined $args{dir}) {
$msgloc = "in $args{dir}";
}
die "command `@{$args{cmd}}' failed with exit status $res->{status} $msgloc";
}
return $res->{stdout};
}