diff options
author | Jesse Luehrs <doy@tozt.net> | 2021-12-22 21:11:31 -0500 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2021-12-22 21:11:31 -0500 |
commit | 612b5a82ccffe18510eb6608e53b98c0da7c4212 (patch) | |
tree | da6afa1c39367f60bf6c362fd7d79569fff457ea /src | |
parent | cab3ac4b31f01ea929f98cf6754a3125b785f4b2 (diff) | |
download | nbsh-612b5a82ccffe18510eb6608e53b98c0da7c4212.tar.gz nbsh-612b5a82ccffe18510eb6608e53b98c0da7c4212.zip |
only kill the whole command line on SIGINT
not quite sure if this is totally correct, but it's more correct for now
Diffstat (limited to 'src')
-rw-r--r-- | src/state/history.rs | 16 |
1 files changed, 10 insertions, 6 deletions
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 |