kkawakam / rustyline

Readline Implementation in Rust
https://crates.io/crates/rustyline/
MIT License
1.52k stars 175 forks source link

fix(unix): restore terminal mode #724

Closed miraclx closed 1 year ago

miraclx commented 1 year ago

https://github.com/kkawakam/rustyline/pull/717 migrated to the use of the termios crate for handling terminal modes.

Small oversight in the patch made it so the raw mode patch needed for this crate leaks into the terminal.

Repro (on master 35ea49a):

$ stty
speed 38400 baud;
lflags: echoe echok echoke echoctl pendin
oflags: -oxtabs
cflags: cs8 -parenb
$
$ # let's pick any example to run
$
$ cargo run --features derive --example example
    Finished dev [unoptimized + debuginfo] target(s) in 0.03s
     Running `target/debug/examples/example`
1> ^C
Interrupted
$
$ # now, we can clearly see the leak
$
$ stty
speed 38400 baud;
lflags: -icanon -isig -iexten -echo echoe echok echoke echoctl
iflags: -icrnl -ixon -brkint
oflags: -oxtabs
cflags: cs8 -parenb
gwenn commented 1 year ago

Many thanks