From 98c4da806fbc892673feb13eeeead51cc520247f Mon Sep 17 00:00:00 2001 From: Ole Tange Date: Sun, 5 Apr 2015 04:36:17 +0200 Subject: [PATCH] parallel: Update --bar/--progress/--eta more aggresively for: seq 1000 | parallel --eta -j0 sleep 0.{} --- src/parallel | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/src/parallel b/src/parallel index bb159a7d..84ba1f5e 100755 --- a/src/parallel +++ b/src/parallel @@ -2258,19 +2258,28 @@ sub progress { my ($columns,$last_column_time); sub terminal_columns { - # Get the number of columns of the display + # Get the number of columns of the terminal. + # Only update once per second. # Returns: # number of columns of the screen if(not $columns or $last_column_time < time) { $last_column_time = time; $columns = $ENV{'COLUMNS'}; if(not $columns) { - my $resize = qx{ sh -c 'resize 2>/dev/null' }; - $resize =~ /COLUMNS=(\d+);/ and do { $columns = $1; }; + my $stty = qx{ stty -a /dev/null' }; + $resize =~ /COLUMNS=(\d+);/ and do { $columns = $1; }; } $columns ||= 80; } @@ -2985,6 +2994,10 @@ sub reaper { $Global::total_running--; delete $Global::running{$stiff}; start_more_jobs(); + if($opt::progress) { + my %progress = progress(); + ::status("\r",$progress{'status'}); + } } debug("run", "done "); return $children_reaped;