Skip to content

Don't run tput every time we print a progress bar #86

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

Open
karkhaz opened this issue Jan 25, 2022 · 0 comments
Open

Don't run tput every time we print a progress bar #86

karkhaz opened this issue Jan 25, 2022 · 0 comments

Comments

@karkhaz
Copy link
Contributor

karkhaz commented Jan 25, 2022

Currently, we attempt to run tput as a subprocess just before printing a progress bar, this is obviously a huge waste since the terminal width doesn't change that often.

We should measure the terminal width once, and update that value only when the terminal width changes. We can be informed of such changes by registering a signal handler for SIGWINCH.

Due to the complexities of handling signals from a multithreaded python program, this item might be impossible or very difficult, and I have no idea how to test it.

Acceptance

The _OutputAccumulator class shells out to tput once at program startup, and then only again when the controlling terminal size changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant