From: Darold Gilles Date: Thu, 21 Feb 2013 22:41:20 +0000 (+0100) Subject: Fix display of last print of progress bar when quiet mode is enabled. X-Git-Tag: v3.2~28 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=8fe40fe619d73e271973e7a54201b1b4f6956cad;p=pgbadger Fix display of last print of progress bar when quiet mode is enabled. --- diff --git a/pgbadger b/pgbadger index 4b517ba..b50cfa9 100755 --- a/pgbadger +++ b/pgbadger @@ -631,9 +631,11 @@ if ( ($queue_size > 1) || ($job_per_file > 1) ) { $writer->autoflush(1); # Fork the logger process - spawn sub { - &multiprocess_progressbar($global_totalsize); - }; + if ($progress) { + spawn sub { + &multiprocess_progressbar($global_totalsize); + }; + } # Parse each log file following the multiprocess mode chosen (-j or -J) foreach my $logfile ( @given_log_files ) { @@ -675,8 +677,10 @@ if ( ($queue_size > 1) || ($job_per_file > 1) ) { last if ($interrupt); } + my $minproc = 1; + $minproc = 0 if (!$progress); # Wait for all child dies less the logger - while (scalar keys %RUNNING_PIDS > 1) { + while (scalar keys %RUNNING_PIDS > $minproc) { my $kid = waitpid(-1, WNOHANG); if ($kid > 0) { delete $RUNNING_PIDS{$kid};