console-rs / console-rs/console
On Linux if program exits when read_char() is blocking, the terminal will stay in raw mode
Open
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 1.2k
- Forks
- 144
- Avg merge
- 8h 24m
- Merged PRs (30d)
- 4
Description
Problem
Run the following code on Linux with console v0.15.7:
use std::{thread, time::Duration};
fn main() {
println!("(This program will exit in 5 seconds.)");
println!("Press any key, and the program will echo the key you pressed.");
thread::spawn(|| {
let terminal = console::Term::stdout();
loop {
let key_pressed = terminal.read_char().unwrap(); // ← Blocking
println!("You pressed: {}", key_pressed);
}
});
thread::sleep(Duration::from_secs(5));
panic!("After the program exits, the terminal will stay in raw mode.")
}
After the program exits, the terminal will stay in raw mode. Anything I type in shell does not display on screen.
Related issues
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by running the provided Linux reproduction with console v0.15.7 and observe the terminal after the process exits while read_char() is blocked. Read related issues 36 and 136, then trace the terminal raw-mode handling; done means the shell displays typed input normally after the program exits.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- cli, operating-systems
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100