mirror of
https://git.savannah.gnu.org/git/parallel.git
synced 2024-12-22 20:57:53 +00:00
Fixed: bug #42842: --bar with weird chars
This commit is contained in:
parent
af23562d99
commit
cb3197582a
27
CREDITS
27
CREDITS
|
@ -1,2 +1,29 @@
|
|||
rici@stackoverflow.com: Documentation on exporting arrays using --env.
|
||||
Malcolm Cook: The idea to use a general perl expression as replacement strings.
|
||||
Ævar Arnfjörð Bjarmason: Reading the whole code.
|
||||
Christian Netrwal: CPU detection code for AIX.
|
||||
alpinelinux.org/users/ncopa: Maintaining GNU Parallel for Alpine GNU/Linux.
|
||||
Ondřej Surý: Maintaining GNU Parallel for Debian GNU/Linux.
|
||||
Rogério Brito: Maintaining GNU Parallel for Ubuntu GNU/Linux.
|
||||
Tim Harder: Maintaining GNU Parallel for Gentoo GNU/Linux.
|
||||
Chris Howey: Maintaining GNU Parallel for FreeBSD.
|
||||
cheusov: Maintaining GNU Parallel for NetBSD.
|
||||
https://fedoraproject.org/wiki/User:Golfu: Maintaining GNU Parallel for Fedora GNU/Linux.
|
||||
Pascal Stumpf: Maintaining GNU Parallel for OpenBSD.
|
||||
Sandro Cazzaniga: Maintaining GNU Parallel for Mandriva/Mageia.
|
||||
Alan Coopersmith: Maintaining GNU Parallel for Solaris.
|
||||
jengelh@inai.de: Maintaining GNU Parallel for openSUSE.
|
||||
Timothy Redaelli: Maintaining GNU Parallel for Arch GNU/Linux.
|
||||
Michael Shigorin: Maintaining GNU Parallel for Alt GNU/Linux.
|
||||
Jesse Alama: Maintaining GNU Parallel for Fink.
|
||||
jacknagel: Maintaining GNU Parallel for Homebrew.
|
||||
Jonathan Palardy: Maintaining GNU Parallel for Homebrew.
|
||||
Tim Cuthbertson: Maintaining GNU Parallel for 0install.
|
||||
Michael Perzl: Maintaining GNU Parallel for AIX.
|
||||
Peter Simons: Maintaining GNU Parallel for Arch GNU/Linux.
|
||||
Fethican Coşkuner: Maintaining GNU Parallel for Pardus.
|
||||
Wayne E. Seguin: CPU detection improvement for Mac OSX.
|
||||
Michał Markowski: OpenBSD CPU detection.
|
||||
Drew Frank: Work on --results.
|
||||
Javier Tarradas: HPUX CPU/core detection.
|
||||
Anders F Björklund: niceload: Darwin version of --io --mem --swap.
|
||||
|
|
61
src/parallel
61
src/parallel
|
@ -1819,18 +1819,23 @@ sub progress {
|
|||
my $arg = $Global::newest_job ?
|
||||
$Global::newest_job->{'commandline'}->replace_placeholders(["\257<\257>"],0,0) : "";
|
||||
# [\011\013\014] messes up display in the terminal
|
||||
$arg =~ s/[\011\013\014]//g;
|
||||
my $bar_text = sprintf("%d%% %d:%d=%ds %s",
|
||||
$pctcomplete*100, $completed, $left, $this_eta, $arg);
|
||||
my $rev = '[7m';
|
||||
my $reset = '[0m';
|
||||
$arg =~ tr/[\011-\016\033\302-\365]//d;
|
||||
my $bar_text =
|
||||
sprintf("%d%% %d:%d=%ds %s",
|
||||
$pctcomplete*100, $completed, $left, $this_eta, $arg);
|
||||
my $rev = "\033[7m";
|
||||
my $reset = "\033[0m";
|
||||
my $terminal_width = terminal_columns();
|
||||
my $s = sprintf("%-${terminal_width}s",
|
||||
substr($bar_text,0,$terminal_width));
|
||||
substr($bar_text." "x$terminal_width,
|
||||
0,$terminal_width));
|
||||
my $width = int($terminal_width * $pctcomplete);
|
||||
$s =~ s/^(.{$width})/$1$reset/;
|
||||
$s = "\r# ".int($this_eta)." sec $arg" . "\r". $pctcomplete*100 # Prefix with zenity header
|
||||
. "\r" . $rev . $s . $reset;
|
||||
substr($s,$width,0) = $reset;
|
||||
my $zenity = sprintf("%-${terminal_width}s",
|
||||
substr("# " . int($this_eta) . " sec $arg",
|
||||
0,$terminal_width));
|
||||
$s = "\r" . $zenity . "\r" . $pctcomplete*100 . # Prefix with zenity header
|
||||
"\r" . $rev . $s . $reset;
|
||||
$status = $s;
|
||||
}
|
||||
}
|
||||
|
@ -1952,19 +1957,23 @@ sub progress {
|
|||
return ("workerlist" => $workerlist, "header" => $header, "status" => $status);
|
||||
}
|
||||
|
||||
sub terminal_columns {
|
||||
# Get the number of columns of the display
|
||||
# Returns:
|
||||
# number of columns of the screen
|
||||
if(not $Private::columns) {
|
||||
$Private::columns = $ENV{'COLUMNS'};
|
||||
if(not $Private::columns) {
|
||||
my $resize = qx{ resize 2>/dev/null };
|
||||
$resize =~ /COLUMNS=(\d+);/ and do { $Private::columns = $1; };
|
||||
}
|
||||
$Private::columns ||= 80;
|
||||
{
|
||||
my $columns;
|
||||
|
||||
sub terminal_columns {
|
||||
# Get the number of columns of the display
|
||||
# Returns:
|
||||
# number of columns of the screen
|
||||
if(not $columns) {
|
||||
$columns = $ENV{'COLUMNS'};
|
||||
if(not $columns) {
|
||||
my $resize = qx{ resize 2>/dev/null };
|
||||
$resize =~ /COLUMNS=(\d+);/ and do { $columns = $1; };
|
||||
}
|
||||
$columns ||= 80;
|
||||
}
|
||||
return $columns;
|
||||
}
|
||||
return $Private::columns;
|
||||
}
|
||||
|
||||
sub get_job_with_sshlogin {
|
||||
|
@ -2192,7 +2201,7 @@ sub filter_hosts {
|
|||
# Get server from: eval true server\;
|
||||
$col[8] =~ /eval true..([^;]+).;/ or ::die_bug("col8 does not contain host: $col[8]");
|
||||
my $host = $1;
|
||||
$host =~ s/\\//g;
|
||||
$host =~ tr/\\//d;
|
||||
$Global::host{$host} or next;
|
||||
if($col[6] eq "255" or $col[7] eq "15") {
|
||||
# exit == 255 or signal == 15: ssh failed
|
||||
|
@ -4381,8 +4390,8 @@ sub total_jobs {
|
|||
my @queue;
|
||||
my $start = time;
|
||||
while($job = $self->get()) {
|
||||
if(time - $start > 30) {
|
||||
::warning("Reading all arguments takes longer than 30 seconds.\n");
|
||||
if(time - $start > 10) {
|
||||
::warning("Reading all arguments takes longer than 10 seconds.\n");
|
||||
$opt::eta && ::warning("Consider removing --eta.\n");
|
||||
$opt::bar && ::warning("Consider removing --bar.\n");
|
||||
last;
|
||||
|
@ -5405,7 +5414,7 @@ sub tmux_wrap {
|
|||
my $title = ::undef_as_empty($self->{'commandline'}->replace_placeholders(["\257<\257>"],0,0))."";
|
||||
# ; causes problems
|
||||
# ascii 194-245 annoys tmux
|
||||
$title =~ s/[\011-\016;\302-\365]//g;
|
||||
$title =~ tr/[\011-\016;\302-\365]//d;
|
||||
|
||||
my $tmux;
|
||||
if($Global::total_running == 0) {
|
||||
|
@ -6349,7 +6358,7 @@ sub new {
|
|||
# So there is no need to deal with \257<
|
||||
while($c =~ s/ (\S*\000\S*) //x) {
|
||||
my $w = $1;
|
||||
$w =~ s/\000//g; # Remove all \000's
|
||||
$w =~ tr/\000//d; # Remove all \000's
|
||||
$contextlen += length($w);
|
||||
$contextgroups++;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue