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

Break loop when channel is closed #48

Merged
merged 1 commit into from
Mar 3, 2024
Merged

Conversation

MMitsuha
Copy link
Contributor

@MMitsuha MMitsuha commented Mar 3, 2024

When I keep typing on the keyboard and press ESC to exit the program, the program will panic due to channel closure.

image

@Valentin271 Valentin271 merged commit c979e6f into ratatui-org:main Mar 3, 2024
3 checks passed
Copy link
Member

@joshka joshka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suspect that this is still a bug as the select can complete on either branch of the select in a non-deterministic fashion. The right way to handle (I think) is to not fail when the sender fails to send. The send failing can indicator that the receiver is closed. See https://docs.rs/tokio/latest/tokio/sync/mpsc/struct.Sender.html

I think there's probably a second bug with this in how cancelations are handled https://docs.rs/tokio/latest/tokio/sync/mpsc/struct.Sender.html#cancel-safety

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

4 participants