Be more verbose when debugging is on
authorRichard Levitte <levitte@openssl.org>
Wed, 17 Feb 2016 21:04:54 +0000 (22:04 +0100)
committerRichard Levitte <levitte@openssl.org>
Wed, 17 Feb 2016 21:11:55 +0000 (22:11 +0100)
It's near impossible to figure out what goes wrong with the execution
of sub-commands otherwise.

Reviewed-by: Rich Salz <rsalz@openssl.org>
util/TLSProxy/Proxy.pm

index 9883901b944d2d2cfa3c6117c18c446274d15940..7d21f4e83d6e46311bcef1b5572b1a639b4ce753 100644 (file)
@@ -178,9 +178,11 @@ sub start
 
     $pid = fork();
     if ($pid == 0) {
 
     $pid = fork();
     if ($pid == 0) {
-        open(STDOUT, ">", File::Spec->devnull())
-            or die "Failed to redirect stdout: $!";
-        open(STDERR, ">&STDOUT");
+        if (!$self->debug) {
+            open(STDOUT, ">", File::Spec->devnull())
+                or die "Failed to redirect stdout: $!";
+            open(STDERR, ">&STDOUT");
+        }
         my $execcmd = $self->execute
             ." s_server -no_comp -rev -engine ossltest -accept "
             .($self->server_port)
         my $execcmd = $self->execute
             ." s_server -no_comp -rev -engine ossltest -accept "
             .($self->server_port)
@@ -227,9 +229,11 @@ sub clientstart
     if ($self->execute) {
         my $pid = fork();
         if ($pid == 0) {
     if ($self->execute) {
         my $pid = fork();
         if ($pid == 0) {
-            open(STDOUT, ">", File::Spec->devnull())
-                or die "Failed to redirect stdout: $!";
-            open(STDERR, ">&STDOUT");
+            if (!$self->debug) {
+                open(STDOUT, ">", File::Spec->devnull())
+                    or die "Failed to redirect stdout: $!";
+                open(STDERR, ">&STDOUT");
+            }
             my $execcmd = "echo test | ".$self->execute
                  ." s_client -engine ossltest -connect "
                  .($self->proxy_addr).":".($self->proxy_port);
             my $execcmd = "echo test | ".$self->execute
                  ." s_client -engine ossltest -connect "
                  .($self->proxy_addr).":".($self->proxy_port);