piotrmurach / tty-progressbar

Display a single or multiple progress bars in the terminal.

Home Page:https://ttytoolkit.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Progressbar crashed when terminal size change

ondra-m opened this issue · comments

If progressbar is finished and terminal size is changed:

tty-progressbar-0.8.1/lib/tty/progressbar.rb:188:in `resize'
tty-progressbar-0.8.1/lib/tty/progressbar.rb:309:in `block in register_signals'

Thanks for reporting, will take a look.

Sorry, error was Error: Cannot resize finished progress bar.

Ah, probably it's better to log an error than crash.

Hi Piotr, yes I've seen this a couple of times as well and would agree that it would be better if it didn't call 'fail' on line 188 (which stops everything including the process that it's showing progress for). I would think that just outputting/logging an error would be sufficient for most requirements. Thanks!

Indeed Chris, it is definitely a bug scenario, I shall fix it soon.

Super - thanks Piotr!

Would not be better to remove register_signals method?

Hi Ondrej, agreed, I've decided to remove register_signals on the basis that exit codes and script behaviour should be left to developer to handle. Thanks.

Released v0.9.0