]> git.vpit.fr Git - perl/modules/Test-Valgrind.git/blobdiff - lib/Test/Valgrind.pm
Log valgrind output to a specific fd so that the output of the script doesn't get...
[perl/modules/Test-Valgrind.git] / lib / Test / Valgrind.pm
index f5cee9020cc5d8f434e1ad83324a8a85497452cb..f50edd67eba67a68b166dbc8fb195f6de22b4044 100644 (file)
@@ -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<http://valgrind.org>).
 
-L<Carp>, L<POSIX> (core modules since perl 5) and L<Test::Builder> (since 5.6.2).
+L<Carp>, L<Fcntl>, L<POSIX> (core modules since perl 5) and L<Test::Builder> (since 5.6.2).
 
 L<Perl::Destruct::Level>.