treat exit status code > 0 as an error

This commit is contained in:
Andika Demas Riyandi 2021-03-31 20:29:45 +07:00
parent 751e598468
commit ffba2a767d

View File

@ -183,7 +183,14 @@ pub fn run_treefmt(
match formatter.clone().fmt(&paths) {
// FIXME: do we care about the output?
Ok(_) => {
Ok(out) => {
if let Some(scode) = out.status.code() {
if scode > 0 {
error!("{} failed: exit status {}", &formatter, scode);
return (formatter_name.clone(), path_mtime.clone());
}
}
info!(
"{}: {} files processed in {:.2?}",
formatter.name,