Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make RefreshInterval configurable and render bars one last time at Stop() #24

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

rck
Copy link

@rck rck commented Jan 6, 2017

This pull request contains 2 patches.

  • RefreshInterval was not considered because the default bar was already created before the user could set this public variable. Setting the variable and then calling Start() is now possible.
  • When a program exited before uiprogress had a change to render the output, it looked like bars did not finish. So far there was a workaround by sleeping, but this should not be necessary.

Regards, rck

This variable is public, but has no effect. All operations like AddBar()
are executed on the default progress bar (defaultProgress). This default
bar is created at initialization time (var defaultProgress = New()).
Therefore setting RefreshInterval and then calling Start() has no
effect, as the old default RefreshInterval was already used.

This is changed by initializing the default progress bar when it is
actually used.
If there where multiple progress bars (e.g., multiple go routines, one
per bar), it could happen that the last go routine finished and then
main finished before the last bar got updated. On the command line this
then looks like the last go routine failed because it never rendered the
"100%" state, even if it reached it. This fixes that by calling refresh
one last time on Stop().
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant