From: Vincent Pit Date: Sat, 29 Nov 2008 11:18:19 +0000 (+0100) Subject: Print more useful error messages when run() fails X-Git-Tag: v0.03~14 X-Git-Url: http://git.vpit.fr/?a=commitdiff_plain;h=afb044f01dfbb8113137ed467e8c68c6748f1625;p=perl%2Fmodules%2FCPANPLUS-Dist-Gentoo.git Print more useful error messages when run() fails --- diff --git a/lib/CPANPLUS/Dist/Gentoo.pm b/lib/CPANPLUS/Dist/Gentoo.pm index f681819..43260ba 100644 --- a/lib/CPANPLUS/Dist/Gentoo.pm +++ b/lib/CPANPLUS/Dist/Gentoo.pm @@ -237,8 +237,10 @@ sub create { } msg 'Adding Manifest entry for ' . $stat->dist; - unless (scalar run command => [ 'ebuild', $file, 'manifest' ], verbose => 0) { - error 'ebuild manifest failed -- aborting'; + my ($success, $errmsg) = run command => [ 'ebuild', $file, 'manifest' ], + verbose => 0; + unless ($success) { + error "$errmsg -- aborting"; 1 while unlink $file; return 0; } @@ -256,8 +258,10 @@ sub install { my @cmd = ('emerge', '=' . $stat->eb_name . '-' . $stat->eb_version); unshift @cmd, $sudo if $sudo; - unless (run command => \@cmd, verbose => 1) { - error 'emerge failed -- aborting'; + my ($success, $errmsg) = run command => \@cmd, + verbose => 1; + unless ($success) { + error "$errmsg -- aborting"; return 0; } @@ -273,8 +277,10 @@ sub uninstall { my @cmd = ('emerge', '-C', '=' . $stat->eb_name . '-' . $stat->eb_version); unshift @cmd, $sudo if $sudo; - unless (run command => \@cmd, verbose => 1) { - error 'emerge -C failed -- aborting'; + my ($success, $errmsg) = run command => \@cmd, + verbose => 1; + unless ($success) { + error "$errmsg -- aborting"; return 0; }