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

Progress bar crashes on terminal resize #11

Closed
squarism opened this issue Feb 23, 2016 · 4 comments
Closed

Progress bar crashes on terminal resize #11

squarism opened this issue Feb 23, 2016 · 4 comments

Comments

@squarism
Copy link
Contributor

Running the progress bar from the example docs. Resize the terminal while the progress is going.
Tried iTerm and OSX terminal, same result.

~/.rubies/ruby-2.1.6/lib/ruby/2.1.0/monitor.rb:246:in `mon_check_owner': current thread not owner (ThreadError)
    from ~/.rubies/ruby-2.1.6/lib/ruby/2.1.0/monitor.rb:195:in `mon_exit'
    from ~/.rubies/ruby-2.1.6/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:143:in `ensure in require'
    from ~/.rubies/ruby-2.1.6/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:143:in `require'
    from ~/.gem/ruby/2.1.6/gems/tty-screen-0.5.0/lib/tty/screen/size.rb:47:in `try_io_console'
    from ~/.gem/ruby/2.1.6/gems/tty-screen-0.5.0/lib/tty/screen/size.rb:38:in `from_io_console'
    from ~/.gem/ruby/2.1.6/gems/tty-screen-0.5.0/lib/tty/screen/size.rb:22:in `size'
    from ~/.gem/ruby/2.1.6/gems/tty-screen-0.5.0/lib/tty/screen.rb:45:in `size'
    from ~/.gem/ruby/2.1.6/gems/tty-screen-0.5.0/lib/tty/screen.rb:26:in `size'
    from ~/.gem/ruby/2.1.6/gems/tty-screen-0.5.0/lib/tty/screen.rb:31:in `width'
    from ~/.gem/ruby/2.1.6/gems/tty-progressbar-0.8.0/lib/tty/progressbar.rb:266:in `max_columns'
    from ~/.gem/ruby/2.1.6/gems/tty-progressbar-0.8.0/lib/tty/progressbar.rb:289:in `block in register_callbacks'
    from tty_time.rb:5:in `call'
    from tty_time.rb:5:in `sleep'
    from tty_time.rb:5:in `block in <main>'
    from tty_time.rb:4:in `times'
    from tty_time.rb:4:in `<main>'

I was poking around to find more behavior but ran out of time.

@piotrmurach
Copy link
Owner

I've been using the progress bar a lot but haven't been resizing the screen. Thanks for reporting. Would you find time to investigate further?

@squarism
Copy link
Contributor Author

I think I have made progress on this with #12 . Of course it's up to you if you like the change. 🌻

@piotrmurach
Copy link
Owner

I've released v0.8.1 with a patch. I've decided to only trap interrupt signal, trapping exit would swallow genuine exceptions. The resize has been simplified and tested to properly work inside threads and actually resize the progress bar on terminal size change. Please let me know if this works for you.

@squarism
Copy link
Contributor Author

Nice! Seems to work and the change makes sense. Thanks for merging a bit of it. Glad to help. 🌻

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

No branches or pull requests

2 participants