[Bps-public-commit] r12298 - in Shipwright/trunk: .

sunnavy at bestpractical.com sunnavy at bestpractical.com
Tue May 13 11:46:04 EDT 2008


Author: sunnavy
Date: Tue May 13 11:46:03 2008
New Revision: 12298

Modified:
   Shipwright/trunk/   (props changed)
   Shipwright/trunk/lib/Shipwright/Util.pm

Log:
 r12342 at sunnavys-mb:  sunnavy | 2008-05-13 23:22:09 +0800
 don't show output of run3 to stdout


Modified: Shipwright/trunk/lib/Shipwright/Util.pm
==============================================================================
--- Shipwright/trunk/lib/Shipwright/Util.pm	(original)
+++ Shipwright/trunk/lib/Shipwright/Util.pm	Tue May 13 11:46:03 2008
@@ -54,7 +54,10 @@
 
     my ( $out, $err );
     $log->info( "run cmd: " . join ' ', @$cmd );
+    Shipwright::Util->select( 'null' );
     run3( $cmd, \*STDIN, \$out, \$err );
+    Shipwright::Util->select( 'stdout' );
+
     $log->info("run output:\n$out") if $out;
     $log->warn("run err:\n$err")    if $err;
 
@@ -113,6 +116,30 @@
 
 }
 
+
+=sub select
+
+wrapper for the select in core
+
+=cut
+
+my ( $null, $stdout );
+open $null, '>', '/dev/null';
+$stdout = select $null;
+select $stdout;
+
+sub select {
+    my $self = shift;
+    my $type = shift;
+    if ( $type eq 'null' ) {
+        select $null;
+    }
+    elsif ( $type eq 'stdout' ) {
+        select $stdout;
+    }
+}
+
+
 1;
 
 __END__



More information about the Bps-public-commit mailing list