mirror of
https://github.com/fish-shell/fish-shell
synced 2024-11-10 07:04:29 +00:00
Don't break out of panic handler
The previous control flow logic wasn't sound and would leave the shell in a hung state when `break` would be encountered. The behavior is now straightforward, the shell reads until <Enter> or <q> is pressed, at which point it aborts.
This commit is contained in:
parent
4d0aa2b5dd
commit
5278259312
1 changed files with 3 additions and 5 deletions
|
@ -18,13 +18,11 @@ pub fn panic_handler(main: impl FnOnce() -> i32 + UnwindSafe) -> ! {
|
|||
PROGRAM_NAME.get().unwrap(),
|
||||
unsafe { libc::getpid() }
|
||||
);
|
||||
let mut buf = [0_u8; 1];
|
||||
loop {
|
||||
// Move the cursor down so it isn't blocking the text
|
||||
eprintf!("\n");
|
||||
let Ok(n) = read_blocked(STDIN_FILENO, &mut buf) else {
|
||||
break;
|
||||
};
|
||||
let mut buf = [0_u8; 1];
|
||||
loop {
|
||||
let n = read_blocked(STDIN_FILENO, &mut buf).unwrap_or(0);
|
||||
if n == 0 || matches!(buf[0], b'q' | b'\n' | b'\r') {
|
||||
eprintf!("\n");
|
||||
std::process::abort();
|
||||
|
|
Loading…
Reference in a new issue