mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-27 13:23:09 +00:00
Fix panic handler
It wasn't actually exiting and would basically block indefinitely after reading from stdin.
This commit is contained in:
parent
7b7d16da48
commit
4d0aa2b5dd
1 changed files with 3 additions and 1 deletions
|
@ -20,12 +20,14 @@ pub fn panic_handler(main: impl FnOnce() -> i32 + UnwindSafe) -> ! {
|
||||||
);
|
);
|
||||||
let mut buf = [0_u8; 1];
|
let mut buf = [0_u8; 1];
|
||||||
loop {
|
loop {
|
||||||
|
// Move the cursor down so it isn't blocking the text
|
||||||
|
eprintf!("\n");
|
||||||
let Ok(n) = read_blocked(STDIN_FILENO, &mut buf) else {
|
let Ok(n) = read_blocked(STDIN_FILENO, &mut buf) else {
|
||||||
break;
|
break;
|
||||||
};
|
};
|
||||||
if n == 0 || matches!(buf[0], b'q' | b'\n' | b'\r') {
|
if n == 0 || matches!(buf[0], b'q' | b'\n' | b'\r') {
|
||||||
eprintf!("\n");
|
eprintf!("\n");
|
||||||
break;
|
std::process::abort();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
|
|
Loading…
Reference in a new issue