aboutsummaryrefslogtreecommitdiff
path: root/helix-term/src
diff options
context:
space:
mode:
authorPiergiorgioZagaria2022-08-30 02:02:34 +0000
committerGitHub2022-08-30 02:02:34 +0000
commitd2cec25395e01ded0977c1314e377cb24186c6c5 (patch)
tree5211701833b61a31489ed732de828079bbc0f976 /helix-term/src
parent5f043dde56c20e694078ceb46aac5f053327196c (diff)
Fix process spawning error handling (#3349)
* Fix process spawning error handling * Log stderr in any case
Diffstat (limited to 'helix-term/src')
-rw-r--r--helix-term/src/commands.rs14
1 files changed, 12 insertions, 2 deletions
diff --git a/helix-term/src/commands.rs b/helix-term/src/commands.rs
index 885afa18..cb5460af 100644
--- a/helix-term/src/commands.rs
+++ b/helix-term/src/commands.rs
@@ -4596,8 +4596,18 @@ fn shell_impl(
}
let output = process.wait_with_output()?;
- if !output.stderr.is_empty() {
- log::error!("Shell error: {}", String::from_utf8_lossy(&output.stderr));
+ if !output.status.success() {
+ if !output.stderr.is_empty() {
+ let err = String::from_utf8_lossy(&output.stderr).to_string();
+ log::error!("Shell error: {}", err);
+ bail!("Shell error: {}", err);
+ }
+ bail!("Shell command failed");
+ } else if !output.stderr.is_empty() {
+ log::debug!(
+ "Command printed to stderr: {}",
+ String::from_utf8_lossy(&output.stderr).to_string()
+ );
}
let str = std::str::from_utf8(&output.stdout)