Fixed bug #62954: --color-failed outputs extra text.

This commit is contained in:
Ole Tange 2022-08-30 22:38:47 +02:00
parent 034f220f86
commit 6cf9702f6c
3 changed files with 27 additions and 26 deletions

View file

@ -255,21 +255,21 @@ from:tange@gnu.org
to:parallel@gnu.org, bug-parallel@gnu.org to:parallel@gnu.org, bug-parallel@gnu.org
stable-bcc: Jesse Alama <jessealama@fastmail.fm> stable-bcc: Jesse Alama <jessealama@fastmail.fm>
Subject: GNU Parallel 20220822 ('Rushdie') released Subject: GNU Parallel 20220922 ('Sanna Marin') released
GNU Parallel 20220822 ('Rushdie') has been released. It is available for download at: lbry://@GnuParallel:4 GNU Parallel 20220922 ('') has been released. It is available for download at: lbry://@GnuParallel:4
Quote of the month: Quote of the month:
Parallel is Good Stuff (tm) <<>>
-- bloopernova@ycombinator
New in this release: New in this release:
* --header 0 allows using {filename} as replacement string
* Bug fixes and man page updates. * Bug fixes and man page updates.
https://github.com/bfidatadigipres/dpx_encoding
https://pypi.org/project/womm/
GNU Parallel - For people who live life in the parallel lane. GNU Parallel - For people who live life in the parallel lane.

View file

@ -2838,6 +2838,7 @@ sub init_globals() {
$ENV{'PARALLEL_HOME'}, $ENV{'XDG_CACHE_HOME'}."/parallel"); $ENV{'PARALLEL_HOME'}, $ENV{'XDG_CACHE_HOME'}."/parallel");
$Global::cache_dir = $Global::cache_dirs[0] || $Global::cache_dir = $Global::cache_dirs[0] ||
$ENV{'HOME'} . "/.parallel"; $ENV{'HOME'} . "/.parallel";
Job::init_color();
} }
sub parse_halt() { sub parse_halt() {
@ -11639,25 +11640,25 @@ sub tag($) {
sub color($) { sub color($) {
my $self = shift; my $self = shift;
if(not defined $self->{'color'}) { if(not defined $self->{'color'}) {
if($Global::color or $opt::colorfailed) {
init_color();
if($Global::color) { if($Global::color) {
# Choose a value based on the seq # Choose a value based on the seq
$self->{'color'} = $color[$self->seq() % ($#color+1)].$eol; $self->{'color'} = $color[$self->seq() % ($#color+1)].$eol;
$self->{'reset_color'} = $reset_color;
} else {
$self->{'color'} = "";
$self->{'reset_color'} = "";
} }
if($opt::colorfailed) { if($opt::colorfailed) {
if($self->exitstatus()) { if($self->exitstatus()) {
# White on Red # White on Red
# Can this be done more generally? # Can this be done more generally?
$self->{'color'} = "\033[48;5;"."196". $self->{'color'} =
";38;5;"."231"."m".$eol; "\033[48;5;"."196".";38;5;"."231"."m".$eol;
$self->{'reset_color'} = $reset_color;
} }
} }
} else {
$self->{'color'} = "";
} }
} return ($self->{'color'},$self->{'reset_color'});
return ($self->{'color'},$reset_color);
} }
} }

View file

@ -65,15 +65,15 @@ par_blocking_redir stderr
par_blocking_redir stdout par_blocking_redir stdout
par_blocking_redir stdout par_blocking_redir stdout
par_colour_failed --colour-failed --colour par_colour_failed --colour-failed --colour
par_colour_failed seq 1;exit 0(B par_colour_failed seq 1;exit 0
par_colour_failed 1(B par_colour_failed 1
par_colour_failed seq 1;exit 1(B par_colour_failed seq 1;exit 1(B
par_colour_failed 1(B par_colour_failed 1(B
par_colour_failed seq 1;exit 2(B par_colour_failed seq 1;exit 2(B
par_colour_failed 1(B par_colour_failed 1(B
par_colour_failed seq 2;exit 0(B par_colour_failed seq 2;exit 0
par_colour_failed 1(B par_colour_failed 1
par_colour_failed 2(B par_colour_failed 2
par_colour_failed seq 2;exit 1(B par_colour_failed seq 2;exit 1(B
par_colour_failed 1(B par_colour_failed 1(B
par_colour_failed 2(B par_colour_failed 2(B