Skip to content

Commit

Permalink
Changed install() to echo the pacman command used if an error occurs.
Browse files Browse the repository at this point in the history
  • Loading branch information
juster committed Sep 2, 2009
1 parent 07906e4 commit b6b84d3
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions lib/CPANPLUS/Dist/Arch.pm
Original file line number Diff line number Diff line change
Expand Up @@ -375,23 +375,29 @@ END_ERROR

die "Package file $pkgfile_fqp was not found" if ( ! -f $pkgfile_fqp );

my $pacmancmd;

# Make sure the user has access to install a package...
my $sudocmd = $conf->get_program('sudo');
if ( $EFFECTIVE_USER_ID != $ROOT_USER_ID ) {
if ( $sudocmd ) {
system "$sudocmd pacman -U $pkgfile_fqp";
$pacmancmd = "$sudocmd pacman -U $pkgfile_fqp";
}
else {
error $NONROOT_WARNING;
return 0;
}
}
else { system "pacman -U $pkgfile_fqp"; }
else { $pacmancmd = "pacman -U $pkgfile_fqp"; }

if ($CHILD_ERROR) {
system $pacmancmd;

if ( $CHILD_ERROR ) {
error ( $CHILD_ERROR & 127
? sprintf "pacman failed with signal %d", $CHILD_ERROR & 127
: sprintf "pacman returned abnormal status: %d", $CHILD_ERROR >> 8
? sprintf qq{'$pacmancmd' failed with signal %d},
$CHILD_ERROR & 127
: sprintf qq{'$pacmancmd' returned abnormal status: %d},
$CHILD_ERROR >> 8
);
return 0;
}
Expand Down

0 comments on commit b6b84d3

Please sign in to comment.