From: Vincent Pit Date: Sun, 28 Sep 2008 10:25:41 +0000 (+0200) Subject: Log valgrind output to a specific fd so that the output of the script doesn't get... X-Git-Tag: v0.07~9 X-Git-Url: http://git.vpit.fr/?a=commitdiff_plain;h=eea6b233b32970c0ed65a9a9755bdd81201affe7;p=perl%2Fmodules%2FTest-Valgrind.git Log valgrind output to a specific fd so that the output of the script doesn't get mixed up with valgrind data --- diff --git a/Makefile.PL b/Makefile.PL index 28863db..dcac0c9 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -108,6 +108,7 @@ WriteMakefile( PREREQ_PM => { 'Carp' => 0, 'Exporter' => 0, + 'Fcntl' => 0, 'POSIX' => 0, 'Perl::Destruct::Level' => 0, 'Test::Builder' => 0, diff --git a/lib/Test/Valgrind.pm b/lib/Test/Valgrind.pm index f5cee90..f50edd6 100644 --- a/lib/Test/Valgrind.pm +++ b/lib/Test/Valgrind.pm @@ -5,6 +5,7 @@ use warnings; use Carp qw/croak/; use POSIX qw/SIGTERM/; +use Fcntl qw/F_SETFD/; use Test::Builder; use Perl::Destruct::Level level => 3; @@ -157,13 +158,14 @@ sub import { } elsif ($pid == 0) { setpgrp 0, 0 or croak "setpgrp(0, 0): $!"; close $rdr or croak "close(\$rdr): $!"; - open STDERR, '>&', $wtr or croak "open(STDERR, '>&', \$wtr): $!"; + fcntl $wtr, F_SETFD, 0 or croak "fcntl(\$wtr, F_SETFD, 0): $!"; my @args = ( '--tool=memcheck', '--leak-check=full', '--leak-resolution=high', '--num-callers=' . $callers, - '--error-limit=yes' + '--error-limit=yes', + '--log-fd=' . fileno($wtr) ); unless ($args{no_supp}) { for (Test::Valgrind::Suppressions::supp_path(), $args{supp}) { @@ -234,7 +236,7 @@ If your tests output to STDERR, everything will be eaten in the process. In part Valgrind 3.1.0 (L). -L, L (core modules since perl 5) and L (since 5.6.2). +L, L, L (core modules since perl 5) and L (since 5.6.2). L.