[packages/rpm-build-tools/teeboth: 2/4] always append; allow empty logfile (it will just colorise stderr then)
glen
glen at pld-linux.org
Sat Jan 12 11:53:08 CET 2013
commit 9db5cbe86cf6e7fe11648442ca78a3730eb580b6
Author: Elan Ruusamäe <glen at delfi.ee>
Date: Sat Jan 12 12:27:19 2013 +0200
always append; allow empty logfile (it will just colorise stderr then)
teeboth | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
---
diff --git a/teeboth b/teeboth
index b30e92c..caf4620 100755
--- a/teeboth
+++ b/teeboth
@@ -11,7 +11,7 @@ use IO::Select;
my $out = shift @ARGV;
die unless @ARGV;
-open my $fout, ">", $out or die;
+open my $fout, ">>", $out or die if $out;
my $select = IO::Select->new();
my $alive = 1;
@@ -44,7 +44,7 @@ sub sethandle
$flags |= O_NONBLOCK;
fcntl ( $h, F_SETFL, $flags )
or die "Couldn't set flags for HANDLE: $!\n";
-
+
$select->add( $h );
}
@@ -54,7 +54,7 @@ sethandle( \*child_err );
while ( $alive ) {
foreach my $h ( $select->can_read() ) {
sysread $h, $_, 1024;
- print $fout $_;
+ print $fout $_ if $fout;
if ( $h == \*child_err ) {
print "\033[31m$_\033[0m";
} else {
================================================================
---- gitweb:
http://git.pld-linux.org/gitweb.cgi/packages/rpm-build-tools.git/commitdiff/12da9e3d7724a0ef69239325ae50ea859c3f3ae4
More information about the pld-cvs-commit
mailing list