gyscos / gyscos/cursive

[BUG] Panic on console resize after cursive.quit

Open
#571 2 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
Rust
Stars
4.8k
Forks
270
Avg merge
5d 19h
Merged PRs (30d)
2

Description

**Describe the bug**
I need to take over terminal in the middle of the application (shell) therefore I'm executing `cursive.quit()`.
Only event loop is stopped correctly, and other loops are still working causing issues like this one.
That is causing another bug: first key is consumed by cursive inside input handling loop before it shuts down.
Loop responsible for handling terminal resize panics on next resize and causes infinite loop somewhere (I didn't investigated it) and hangs one of the threads in 100% cpu usage.
It looks like after reentering cursive again window resizing is still working, therefore I assume there might be some resource leak (except this hanged thread).

**To Reproduce**
This can be reproduced in `pause` example.
Just resize window when you are redirected to terminal.

**Expected behavior**
It should not crash and hand threads in background, ideally all loops should be closed, i'm not sure what exactly is causing first key to be consumed by cursive that do not happen in pause example, but probably making sure that all internal loops are canceled should solve also that issue.

**Screenshots**
thread '' panicked at 'called `Result::unwrap()` on an `Err` value: "SendError(..)"', .../cursive-0.16.3/src/backends/resize.rs:20:40

**Environment**
* Linux, termion, cursive 0.16.3 but master is also affected

**Additional context**
I found some hints inside termion that suggesting that stdin might not be canceled without getting input or EOF, therefore nice thing to have would be to be able to take or borrow running stdin handled from cursive.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.