[libcode-tidyall-perl] 228/374: Merge stdout and stderr and output all to stderr, so that stdout is dedicated to the tidied content

Jonas Smedegaard js at alioth.debian.org
Sun Sep 29 22:26:25 UTC 2013


This is an automated email from the git hooks/post-receive script.

js pushed a commit to branch master
in repository libcode-tidyall-perl.

commit c3d47f0e5085a6b7c523f69d55ffd382a79c67ed
Author: Jonathan Swartz <swartz at pobox.com>
Date:   Fri Sep 14 10:33:18 2012 -0400

    Merge stdout and stderr and output all to stderr, so that stdout is dedicated to the tidied content
---
 bin/tidyall |   12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/bin/tidyall b/bin/tidyall
index 826a8ce..ef1c031 100755
--- a/bin/tidyall
+++ b/bin/tidyall
@@ -2,6 +2,7 @@
 use Cwd qw(cwd realpath);
 use Getopt::Long;
 use Pod::Usage;
+use Capture::Tiny qw(capture_merged);
 use Code::TidyAll;
 use Code::TidyAll::Util qw(can_load dirname);
 use strict;
@@ -101,7 +102,16 @@ sub handle_pipe {
     my $ct       = $tidyall_class->new_from_conf_file( $conf_file, %params );
     my $root_dir = $ct->root_dir;
     my $source   = do { local $/; <STDIN> };
-    my $result   = $ct->process_source( $source, $ct->_small_path($pipe_filename) );
+
+    # Merge stdout and stderr and output all to stderr, so that stdout is
+    # dedicated to the tidied content
+    #
+    my $result;
+    my $output = capture_merged {
+        $result = $ct->process_source( $source, $ct->_small_path( realpath($pipe_filename) ) );
+    };
+    print STDERR $output;
+
     if ( my $error = $result->error ) {
         return 1;
     }

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-perl/packages/libcode-tidyall-perl.git



More information about the Pkg-perl-cvs-commits mailing list