]> granicus.if.org Git - pgbadger/commitdiff
Fix a case where the progress bar pipe can still be called on Windows.
authorGilles Darold <gilles@darold.net>
Thu, 13 Jun 2019 13:44:01 +0000 (15:44 +0200)
committerGilles Darold <gilles@darold.net>
Thu, 13 Jun 2019 13:44:01 +0000 (15:44 +0200)
pgbadger

index e8e358e371cb0478a1dacee51e4b3f46d09b40c6..e5ba1ddfa1cb7d06906d734d114b6568d996854e 100755 (executable)
--- a/pgbadger
+++ b/pgbadger
@@ -1407,7 +1407,7 @@ if ($incremental && !$remote_host)
 }
 
 # Pipe used for progress bar in multiprocess
-my $pipe;
+my $pipe = undef;
 
 # Seeking to an old log position is not possible outside incremental mode
 if (!$last_parsed) {
@@ -3284,7 +3284,7 @@ sub process_file
        elsif ($fmt eq 'binary')
        {
                &load_stats($lfile);
-               $pipe->print("$totalsize 0 0\n");
+               $pipe->print("$totalsize 0 0\n") if (defined $pipe);
        }
        # Format is not CSV and in incremental mode we are not at end of the file
        else
@@ -3665,7 +3665,7 @@ sub process_file
                        $cursize = $totalsize;
                }
 
-               if (!$tmpoutfile|| not defined $pipe)
+               if (!$tmpoutfile || not defined $pipe)
                {
                        if ($totalsize)
                        {