You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
Downstream programs would ideally be capable of responding correctly to stty interrupt in raw terminals. As it stands, there seems to be a lot of confusion surrounding how to implement this feature, if it's even possible. (I personally haven't used crossterm directly that much, and I'm not sure how to do it, if indeed it is possible.)
Describe the solution you'd like
Documentation on, or facilities added in order to, support a crossterm equivelant of this code:
use std::io::{self,Read};use std::os::unix::io::AsRawFd;use termios::*;fnmain(){let stdin_fd = io::stdin().as_raw_fd();let original_term_config = Termios::from_fd(stdin_fd).unwrap();let interrupt_char = original_term_config.c_cc[VINTR];letmut raw_termios = original_term_config;cfmakeraw(&mut raw_termios);tcsetattr(stdin_fd,TCSANOW,&mut raw_termios).unwrap();println!("Press the interrupt character to exit...\r");letmut buffer = [0u8;1];loop{
io::stdin().read_exact(&mut buffer).unwrap();eprintln!("Got: {:?}\r",&buffer);if buffer[0] == interrupt_char {break;}}tcsetattr(stdin_fd,TCSANOW,&original_term_config).unwrap();}
The purpose being to correctly detect the interrupt character, and watch for it in the raw terminal. So, e.g., if you do stty intr ^Q, and then run this program, it will respect your terminal's interrupt config. (To wit, ideally if you hit Ctrl+Q, the program will correctly be interrupted -- and the program will conversely NOT treat Ctrl+C as an interrupt character.)
The text was updated successfully, but these errors were encountered:
Is your feature request related to a problem? Please describe.
Downstream programs would ideally be capable of responding correctly to stty interrupt in raw terminals. As it stands, there seems to be a lot of confusion surrounding how to implement this feature, if it's even possible. (I personally haven't used crossterm directly that much, and I'm not sure how to do it, if indeed it is possible.)
Describe the solution you'd like
Documentation on, or facilities added in order to, support a crossterm equivelant of this code:
The purpose being to correctly detect the interrupt character, and watch for it in the raw terminal. So, e.g., if you do
stty intr ^Q
, and then run this program, it will respect your terminal's interrupt config. (To wit, ideally if you hit Ctrl+Q, the program will correctly be interrupted -- and the program will conversely NOT treat Ctrl+C as an interrupt character.)The text was updated successfully, but these errors were encountered: