[Bps-public-commit] r10235 - bpsbuilder/BPB/lib/BPB

sunnavy at bestpractical.com sunnavy at bestpractical.com
Thu Jan 3 12:56:09 EST 2008


Author: sunnavy
Date: Thu Jan  3 12:56:09 2008
New Revision: 10235

Modified:
   bpsbuilder/BPB/lib/BPB/Util.pm

Log:
log for run

Modified: bpsbuilder/BPB/lib/BPB/Util.pm
==============================================================================
--- bpsbuilder/BPB/lib/BPB/Util.pm	(original)
+++ bpsbuilder/BPB/lib/BPB/Util.pm	Thu Jan  3 12:56:09 2008
@@ -5,19 +5,25 @@
 use Carp;
 use IPC::Run3;
 
+my $log = Log::Log4perl->get_logger('BPB::Util');
+
 sub run {
     my $class          = shift;
     my $cmd            = shift;
     my $ignore_failure = shift;
 
     my ( $out, $err );
-    run3( $cmd, \undef, \$out, \$err);
+    $log->info( "run cmd:\n" . join ' ', @$cmd );
+    run3( $cmd, \*STDIN, \$out, \$err );
+    $log->info("run output:\n$out") if $out;
+    $log->warn("run err:\n$err" ) if $err;
+
     if ($?) {
         if ($ignore_failure) {
             return;
         }
         else {
-            die "command " . join( ' ', @$cmd ) . "failed: $?, $err";
+            $log->error( 'failed to run ' . join(' ', @$cmd ) . ":$?" );
         }
     }
     else {



More information about the Bps-public-commit mailing list