diff options
author | PiergiorgioZagaria | 2022-08-30 02:02:34 +0000 |
---|---|---|
committer | GitHub | 2022-08-30 02:02:34 +0000 |
commit | d2cec25395e01ded0977c1314e377cb24186c6c5 (patch) | |
tree | 5211701833b61a31489ed732de828079bbc0f976 /helix-term/src | |
parent | 5f043dde56c20e694078ceb46aac5f053327196c (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.rs | 14 |
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) |