display formatter outputs on error

If a formatter fails with exit status > 0, print the captured outputs by
default. As a user, I want to see directly what caused the error.
This commit is contained in:
zimbatm 2021-08-31 17:10:05 +02:00
parent ff9f9601e1
commit 451c293765
No known key found for this signature in database
GPG Key ID: 71BAF6D40C1D63D7

View File

@ -4,7 +4,7 @@ use crate::{expand_exe, expand_if_path, expand_path};
use anyhow::{anyhow, Result};
use console::style;
use globset::{GlobBuilder, GlobSet, GlobSetBuilder};
use log::debug;
use log::{debug, info};
use serde::de::{self, Visitor};
use serde::{Deserialize, Deserializer, Serialize, Serializer};
use std::{fmt, path::Path, path::PathBuf, process::Command};
@ -97,7 +97,7 @@ impl Formatter {
match cmd.output() {
Ok(out) => {
if !out.status.success() {
debug!(
info!(
"Error using formatter {}:\n{stdout}:\n{}\n{stderr}:\n{}",
self.name,
String::from_utf8_lossy(&out.stdout),