Simplify SIGQUIT handling (#11381)

# Description
Simplifies `SIGQUIT` protection to a single `signal` ignore system call.

# User-Facing Changes
`SIGQUIT` is no longer blocked if nushell is in non-interactive mode
(signals should not be blocked in non-interactive mode).
Also a breaking API change for `nu_protocol`.

# Tests + Formatting
Should come after #11178 for testing.
This commit is contained in:
Ian Manske
2023-12-21 16:00:38 +00:00
committed by GitHub
parent 8cfa96b4c0
commit 3a050864df
5 changed files with 3 additions and 47 deletions

View File

@ -95,8 +95,6 @@ pub struct EngineState {
pub table_decl_id: Option<usize>,
#[cfg(feature = "plugin")]
pub plugin_signatures: Option<PathBuf>,
#[cfg(not(windows))]
sig_quit: Option<Arc<AtomicBool>>,
config_path: HashMap<String, PathBuf>,
pub history_session_id: i64,
// If Nushell was started, e.g., with `nu spam.nu`, the file's parent is stored here
@ -152,8 +150,6 @@ impl EngineState {
table_decl_id: None,
#[cfg(feature = "plugin")]
plugin_signatures: None,
#[cfg(not(windows))]
sig_quit: None,
config_path: HashMap::new(),
history_session_id: 0,
currently_parsed_cwd: None,
@ -862,21 +858,6 @@ impl EngineState {
}
}
#[cfg(not(windows))]
pub fn get_sig_quit(&self) -> &Option<Arc<AtomicBool>> {
&self.sig_quit
}
#[cfg(windows)]
pub fn get_sig_quit(&self) -> &Option<Arc<AtomicBool>> {
&None
}
#[cfg(not(windows))]
pub fn set_sig_quit(&mut self, sig_quit: Arc<AtomicBool>) {
self.sig_quit = Some(sig_quit)
}
pub fn set_config_path(&mut self, key: &str, val: PathBuf) {
self.config_path.insert(key.to_string(), val);
}