aboutsummaryrefslogtreecommitdiff
path: root/helix-term/src/commands/typed.rs
diff options
context:
space:
mode:
authorCyrill Schenkel2024-03-19 12:30:34 +0000
committerGitHub2024-03-19 12:30:34 +0000
commit5b8bfc547607602a557c6115bb5edb557099f8f2 (patch)
tree4d3f88326d3a6e7c888be24d7191a3f06ab9453d /helix-term/src/commands/typed.rs
parent485c5cf0b81ed1f189c5bb06263667449d5684d6 (diff)
Prevent `shell_keep_pipe` from stopping on nonzero exit status code (#9817)
The `shell_impl` and `shell_impl_async` functions no longer return `success` because it was always `true`. If the command didn't succeed both functions would return an `Err`. This was also the reason, why `shell_keep_pipe` didn't work. It relied upon the value of `success` and aborted in case of an `Err`. It now removes any selection for which `shell_impl` returns `Err`. If the command always fails, the selections are preserved and an error message is displayed in the status bar.
Diffstat (limited to 'helix-term/src/commands/typed.rs')
-rw-r--r--helix-term/src/commands/typed.rs8
1 files changed, 2 insertions, 6 deletions
diff --git a/helix-term/src/commands/typed.rs b/helix-term/src/commands/typed.rs
index 2ca3a561..593837e2 100644
--- a/helix-term/src/commands/typed.rs
+++ b/helix-term/src/commands/typed.rs
@@ -2261,7 +2261,7 @@ fn run_shell_command(
let args = args.join(" ");
let callback = async move {
- let (output, success) = shell_impl_async(&shell, &args, None).await?;
+ let output = shell_impl_async(&shell, &args, None).await?;
let call: job::Callback = Callback::EditorCompositor(Box::new(
move |editor: &mut Editor, compositor: &mut Compositor| {
if !output.is_empty() {
@@ -2274,11 +2274,7 @@ fn run_shell_command(
));
compositor.replace_or_push("shell", popup);
}
- if success {
- editor.set_status("Command succeeded");
- } else {
- editor.set_error("Command failed");
- }
+ editor.set_status("Command succeeded");
},
));
Ok(call)