mirror of
https://github.com/nushell/nushell.git
synced 2025-08-09 02:24:58 +02:00
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:
@ -213,20 +213,6 @@ pub fn evaluate_repl(
|
||||
use_color,
|
||||
);
|
||||
|
||||
start_time = std::time::Instant::now();
|
||||
// Reset the SIGQUIT handler
|
||||
if let Some(sig_quit) = engine_state.get_sig_quit() {
|
||||
sig_quit.store(false, Ordering::SeqCst);
|
||||
}
|
||||
perf(
|
||||
"reset sig_quit",
|
||||
start_time,
|
||||
file!(),
|
||||
line!(),
|
||||
column!(),
|
||||
use_color,
|
||||
);
|
||||
|
||||
start_time = std::time::Instant::now();
|
||||
let config = engine_state.get_config();
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
Reference in New Issue
Block a user