fix(render): pprevent the shell extension from failing if stderr is not empty but process exits successfully. Fix #563

This commit is contained in:
Federico Terzi 2021-10-13 22:03:30 +02:00
parent af70305ccc
commit 7987e01d72

View File

@ -24,7 +24,7 @@ use std::{
};
use crate::{Extension, ExtensionOutput, ExtensionResult, Params, Value};
use log::{info, warn};
use log::{error, info};
use thiserror::Error;
#[allow(clippy::upper_case_acronyms)]
@ -191,24 +191,16 @@ impl Extension for ShellExtension {
info!("this debug information was shown because the 'debug' option is true.");
}
let ignore_error = params
.get("ignore_error")
.and_then(|v| v.as_bool())
.copied()
.unwrap_or(false);
if !output.status.success() || !error_str.trim().is_empty() {
warn!(
if !output.status.success() {
error!(
"shell command exited with code: {} and error: {}",
output.status, error_str
);
if !ignore_error {
return ExtensionResult::Error(
ShellExtensionError::ExecutionError(error_str.to_string()).into(),
);
}
}
let trim = params
.get("trim")