Permalink
Browse files

if install fails, propagate exception

  • Loading branch information...
1 parent dc3d285 commit 41b958bfc005b80cfbba7750c006e746e82629b2 @rjbs committed Feb 8, 2014
Showing with 13 additions and 11 deletions.
  1. +13 −11 lib/Dist/Zilla/Dist/Builder.pm
@@ -653,7 +653,7 @@ sub install {
my ($target, $latest) = $self->ensure_built_in_tmpdir;
- eval {
+ my $ok = eval {
## no critic Punctuation
my $wd = File::pushd::pushd($target);
my @cmd = $arg->{install_command}
@@ -662,19 +662,21 @@ sub install {
$self->log_debug([ 'installing via %s', \@cmd ]);
system(@cmd) && $self->log_fatal([ "error running %s", \@cmd ]);
+ 1;
};
- if ($@) {
- $self->log($@);
- $self->log("left failed dist in place at $target");
+ unless ($ok) {
+ my $error = $@ || '(exception clobered)';
+ $self->log("install failed, left failed dist in place at $target");
+ die $error;
+ }
+
+ if ($arg->{keep_build_dir}) {
+ $self->log("all's well; left dist in place at $target");
} else {
- if ($arg->{keep_build_dir}) {
- $self->log("all's well; left dist in place at $target");
- } else {
- $self->log("all's well; removing $target");
- $target->rmtree;
- $latest->remove if $latest;
- }
+ $self->log("all's well; removing $target");
+ $target->rmtree;
+ $latest->remove if $latest;
}
return;

0 comments on commit 41b958b

Please sign in to comment.