[openssl-commits] [openssl] master update

Richard Levitte levitte at openssl.org
Mon Jun 6 13:51:59 UTC 2016


The branch master has been updated
       via  81b538e51e34e258af96ebaf147c0059ef855829 (commit)
      from  ec772a817afc0f788c38006f623204a7d76221ec (commit)


- Log -----------------------------------------------------------------
commit 81b538e51e34e258af96ebaf147c0059ef855829
Author: Richard Levitte <levitte at openssl.org>
Date:   Mon Jun 6 15:01:50 2016 +0200

    tests: fix the shutting up of the shell
    
    If we're going to redirect STDERR and STDOUT, it's better to do it by
    the book.  This fix is a straight copy of examples in the perlfunc
    manual.
    
    Reviewed-by: Matt Caswell <matt at openssl.org>

-----------------------------------------------------------------------

Summary of changes:
 test/testlib/OpenSSL/Test.pm | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/test/testlib/OpenSSL/Test.pm b/test/testlib/OpenSSL/Test.pm
index 1e9730b..2cfb22a 100644
--- a/test/testlib/OpenSSL/Test.pm
+++ b/test/testlib/OpenSSL/Test.pm
@@ -356,9 +356,11 @@ sub run {
     # In non-verbose, we want to shut up the command interpreter, in case
     # it has something to complain about.  On VMS, it might complain both
     # on stdout and stderr
-    *save_STDOUT = *STDOUT;
-    *save_STDERR = *STDERR;
+    my $save_STDOUT;
+    my $save_STDERR;
     if ($ENV{HARNESS_ACTIVE} && !$ENV{HARNESS_VERBOSE}) {
+        open $save_STDOUT, '>&', \*STDOUT or die "Can't dup STDOUT: $!";
+        open $save_STDERR, '>&', \*STDERR or die "Can't dup STDERR: $!";
         open STDOUT, ">", devnull();
         open STDERR, ">", devnull();
     }
@@ -379,9 +381,9 @@ sub run {
     if ($ENV{HARNESS_ACTIVE} && !$ENV{HARNESS_VERBOSE}) {
         close STDOUT;
         close STDERR;
+        open STDOUT, '>&', $save_STDOUT or die "Can't restore STDOUT: $!";
+        open STDERR, '>&', $save_STDERR or die "Can't restore STDERR: $!";
     }
-    *STDOUT = *save_STDOUT;
-    *STDERR = *save_STDERR;
 
     print STDERR "$prefix$display_cmd => $e\n"
         if !$ENV{HARNESS_ACTIVE} || $ENV{HARNESS_VERBOSE};


More information about the openssl-commits mailing list