t/test.pl: Add option to runperl to suppress STDERR
authorKarl Williamson <public@khwilliamson.com>
Sat, 15 Feb 2014 19:48:59 +0000 (12:48 -0700)
committerKarl Williamson <public@khwilliamson.com>
Sat, 15 Feb 2014 22:50:35 +0000 (15:50 -0700)
t/test.pl

index fc64f4a..152c796 100644 (file)
--- a/t/test.pl
+++ b/t/test.pl
@@ -564,7 +564,8 @@ USE_OK
 #   progs    => [ multi-liner (avoid quotes) ]
 #   progfile => perl script
 #   stdin    => string to feed the stdin (or undef to redirect from /dev/null)
-#   stderr   => redirect stderr to stdout
+#   stderr   => If 'devnull' suppresses stderr, if other TRUE value redirect
+#               stderr to stdout
 #   args     => [ command-line arguments to the perl program ]
 #   verbose  => print the command line
 
@@ -680,7 +681,12 @@ sub _create_runperl { # Create the string to qx in runperl().
     if (defined $args{args}) {
        $runperl = _quote_args($runperl, $args{args});
     }
-    $runperl = $runperl . ' 2>&1' if $args{stderr};
+    if ($args{stderr} eq 'devnull') {
+        $runperl = $runperl . ($is_mswin ? ' 2>nul' : ' 2>/dev/null');
+    }
+    elsif ($args{stderr}) {
+        $runperl = $runperl . ' 2>&1';
+    }
     if ($args{verbose}) {
        my $runperldisplay = $runperl;
        $runperldisplay =~ s/\n/\n\#/g;