Skip Menu |
 

This queue is for tickets about the Progress-Any-Output-TermProgressBarColor CPAN distribution.

Report information
The Basics
Id: 132860
Status: resolved
Priority: 0/
Queue: Progress-Any-Output-TermProgressBarColor

People
Owner: Nobody in particular
Requestors: niel.lambrechts [...] gmail.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: Progress bar artefacts
Date: Mon, 22 Jun 2020 09:48:51 +0200
To: bug-Progress-Any-Output-TermProgressBarColor [...] rt.cpan.org
From: Niel Lambrechts <niel.lambrechts [...] gmail.com>
Download (untitled) / with headers
text/plain 2.6k
Hi there, Thanks for this great progress bar. When I test the below script, I get progress bar artefacts in my log output as per the below (you can see there are two progress bars left over on the same lines as "Doing task …" that I have highlighted in bold). Is it possible to avoid this in my output? $ ./test.pl Starting Doing task 1/3 ... nlmacbook4 : SCRIPT: COMPLETED OK Doing task 2/3 ... Doing task 3/3 ... ]5m22s left Finished. ]5m22s left NLMacBook:tmp$ ./test.pl ]5m22s left Starting Doing task 1/3 ... nlmacbook4 : SCRIPT: COMPLETED OK There's something wrong with item 2 There's something wrong with item 44 Doing task 2/3 ...================================================================================ ]1s left Doing task 3/3 ...=================================================================================== ]5s left Finished.============================================================================================= ]1s left Script used for testing (standard one from website): #!/usr/bin/env perl use 5.010; use strict; use warnings; use Log::Any '$log'; use Log::Any::Adapter 'Screen', min_level=>'info'; use Progress::Any '$progress'; use Progress::Any::Output ('TermProgressBarColor', fh=>\*STDERR, width => 120); use Time::HiRes qw(sleep time); $|++; $progress->target(3); $log->info('Starting'); $log->info('Doing task 1/3 ... nlmacbook4 : SCRIPT: COMPLETED OK'); { my $target1 = 30+int(40*rand()); my $progress1 = Progress::Any->get_indicator(task => '1'); $progress1->target($target1); #2 Progress::Any::Output->set({task=>'1'}, 'TermMessage', fh=>\*STDERR, template => '[%-8t] [%P/%2T] %m'); Progress::Any::Output->set({task=>'1'}, 'TermProgressBarColor', fh=>\*STDERR, width => 120); for (1..$target1) { $progress1->update(pos => $_/$target1); if (rand() < 0.025) { $log->warn("There's something wrong with item $_"); } sleep 0.1; } $progress1->stop; $progress1->finish; } $progress->update(pos => 1); $log->info('Doing task 2/3 ...'); { my $target2 = 30+int(40*rand()); for (1..$target2) { $progress->update(pos => 1 + $_/$target2); sleep 0.1; } } $log->info('Doing task 3/3 ...'); { my $target3 = 30+int(40*rand()); for (1..$target3) { $progress->update(pos => 2 + $_/$target3); sleep 0.1; } } $log->info('Finished.'); $progress->finish; exit 0;
Download (untitled) / with headers
text/plain 2.7k
Hi, Sorry for the late reply, didn't see this ticket at first. I've released 0.248 which fixes this, please try it out. On Mon, 22 Jun 2020 07:49:04 GMT, niel.lambrechts@gmail.com wrote: Show quoted text
> Hi there, > > Thanks for this great progress bar. > > When I test the below script, I get progress bar artefacts in my log > output as per the below (you can see there are two progress bars left > over on the same lines as "Doing task …" that I have highlighted in > bold). > > Is it possible to avoid this in my output? > > $ ./test.pl > Starting > Doing task 1/3 ... nlmacbook4 : SCRIPT: COMPLETED OK > Doing task 2/3 ... > Doing task 3/3 ... > ]5m22s left > Finished. > ]5m22s left > NLMacBook:tmp$ ./test.pl > ]5m22s left > Starting > Doing task 1/3 ... nlmacbook4 : SCRIPT: COMPLETED OK > There's something wrong with item 2 > There's something wrong with item 44 > Doing task 2/3 > ...================================================================================ > ]1s left > Doing task 3/3 > ...=================================================================================== > ]5s left > Finished.============================================================================================= > ]1s left > > > Script used for testing (standard one from website): > > #!/usr/bin/env perl > > use 5.010; > use strict; > use warnings; > > use Log::Any '$log'; > use Log::Any::Adapter 'Screen', min_level=>'info'; > > use Progress::Any '$progress'; > use Progress::Any::Output ('TermProgressBarColor', fh=>\*STDERR, width > => 120); > > use Time::HiRes qw(sleep time); > $|++; > > $progress->target(3); > > $log->info('Starting'); > > $log->info('Doing task 1/3 ... nlmacbook4 : SCRIPT: COMPLETED OK'); > { > my $target1 = 30+int(40*rand()); > my $progress1 = Progress::Any->get_indicator(task => '1'); > $progress1->target($target1); > #2 Progress::Any::Output->set({task=>'1'}, 'TermMessage', > fh=>\*STDERR, template => '[%-8t] [%P/%2T] %m'); > Progress::Any::Output->set({task=>'1'}, 'TermProgressBarColor', > fh=>\*STDERR, width => 120); > for (1..$target1) { > $progress1->update(pos => $_/$target1); > if (rand() < 0.025) { > $log->warn("There's something wrong with item $_"); > } > sleep 0.1; > } > $progress1->stop; > $progress1->finish; > } > $progress->update(pos => 1); > > $log->info('Doing task 2/3 ...'); > { > my $target2 = 30+int(40*rand()); > for (1..$target2) { > $progress->update(pos => 1 + $_/$target2); > sleep 0.1; > } > } > > $log->info('Doing task 3/3 ...'); > { > my $target3 = 30+int(40*rand()); > for (1..$target3) { > $progress->update(pos => 2 + $_/$target3); > sleep 0.1; > } > } > > $log->info('Finished.'); > $progress->finish; > exit 0;


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.