mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-27 05:13:10 +00:00
Pop CSI u mode on SIGTERM
As implied by the changelog. Unfortunately it's not obvious how to access the RefCell value in spite of a potential (albeit unlikely) present mutable borrow. We need to use a different type to make it work in such cases, hopefully doing that in future. In future we could even use panic=abort and use this style of cleanup for panics (instead of RAII).
This commit is contained in:
parent
1696b1527a
commit
d30fab372f
1 changed files with 4 additions and 0 deletions
|
@ -2,6 +2,7 @@ use std::num::NonZeroI32;
|
|||
|
||||
use crate::common::{exit_without_destructors, restore_term_foreground_process_group_for_exit};
|
||||
use crate::event::{enqueue_signal, is_signal_observed};
|
||||
use crate::input_common::TERMINAL_PROTOCOLS;
|
||||
use crate::nix::getpid;
|
||||
use crate::reader::{reader_handle_sigint, reader_sighup};
|
||||
use crate::termsize::TermsizeContainer;
|
||||
|
@ -88,6 +89,9 @@ extern "C" fn fish_signal_handler(
|
|||
// Handle sigterm. The only thing we do is restore the front process ID, then die.
|
||||
if !observed {
|
||||
restore_term_foreground_process_group_for_exit();
|
||||
if let Ok(mut term_protocols) = TERMINAL_PROTOCOLS.get().try_borrow_mut() {
|
||||
*term_protocols = None;
|
||||
}
|
||||
// Safety: signal() and raise() are async-signal-safe.
|
||||
unsafe {
|
||||
libc::signal(libc::SIGTERM, libc::SIG_DFL);
|
||||
|
|
Loading…
Reference in a new issue