From 612b5a82ccffe18510eb6608e53b98c0da7c4212 Mon Sep 17 00:00:00 2001 From: Jesse Luehrs Date: Wed, 22 Dec 2021 21:11:31 -0500 Subject: only kill the whole command line on SIGINT not quite sure if this is totally correct, but it's more correct for now --- src/state/history.rs | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/state/history.rs b/src/state/history.rs index 0fe3cf7..a011f1f 100644 --- a/src/state/history.rs +++ b/src/state/history.rs @@ -484,7 +484,7 @@ fn run_commands( ) { async_std::task::spawn(async move { let mut status = async_std::process::ExitStatus::from_raw(0 << 8); - for pipeline in commands.pipelines() { + 'commands: for pipeline in commands.pipelines() { assert_eq!(pipeline.exes().len(), 1); for exe in pipeline.exes() { status = run_exe( @@ -495,13 +495,17 @@ fn run_commands( event_w.clone(), ) .await; - if status.signal().is_some() { - break; + + // i'm not sure what exactly the expected behavior here is - + // in zsh, SIGINT kills the whole command line while SIGTERM + // doesn't, but i don't know what the precise logic is or how + // other signals are handled + if status.signal() + == Some(signal_hook::consts::signal::SIGINT) + { + break 'commands; } } - if status.signal().is_some() { - break; - } } entry.lock_arc().await.exit_info = Some(ExitInfo::new(status)); event_w -- cgit v1.2.3-54-g00ecf