parallel: Use stty -a </dev/tty if resize does not work to find $COLUMNS of terminal.

This commit is contained in:
Ole Tange 2015-04-05 03:57:16 +02:00
parent 338ea44e27
commit 2e68cd95dc

View file

@ -2268,6 +2268,10 @@ sub progress {
my $resize = qx{ sh -c 'resize 2>/dev/null' };
$resize =~ /COLUMNS=(\d+);/ and do { $columns = $1; };
}
if(not $columns) {
my $stty = qx{ stty -a </dev/tty };
$stty =~ /(\d+) columns/ and do { $columns = $1; }
}
$columns ||= 80;
}
return $columns;