-
-
Notifications
You must be signed in to change notification settings - Fork 18
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
prevent panic: send on closed channel
during termination
#15
Conversation
sometimes it's possible to receive a SIGWINCH right in between when `close(tty.ss)` and `close(tty.ws)` are being called, causing a panic. Making the `WINSIZE` production goroutine close the chan will prevent this.
demo code here: #19 |
required by PR: gizak/termui#233 |
I don't think this is right since ws must trigger several time. |
I only know that this definitely fixes the crashes for me. |
Hey @mattn, ss takes all sigwinch syscalls but ss must be depleted before we close ws, otherwise defer close(tty.ws)
for sig := range tty.ss { |
I just understood what is happening with your explanation. |
Thank you |
Thanks !! Sorry, my first explanation was not the clearest 🙂 |
sometimes it's possible to receive a SIGWINCH right in between when
close(tty.ss)
andclose(tty.ws)
are being called, causing a panic.Making the
WINSIZE
production goroutine close the chan will prevent this.