mirror of
https://github.com/numtide/treefmt.git
synced 2024-09-11 17:07:44 +03:00
treat exit status code > 0 as an error (#98)
* treat exit status code > 0 as an error * adding success status check before matching status code
This commit is contained in:
parent
751e598468
commit
0df89fb260
@ -183,7 +183,26 @@ pub fn run_treefmt(
|
||||
|
||||
match formatter.clone().fmt(&paths) {
|
||||
// FIXME: do we care about the output?
|
||||
Ok(_) => {
|
||||
Ok(out) => {
|
||||
if !out.status.success() {
|
||||
match out.status.code() {
|
||||
Some(scode) => {
|
||||
error!(
|
||||
"{}'s formatter failed: exit status {}",
|
||||
&formatter, scode
|
||||
);
|
||||
return (formatter_name.clone(), path_mtime.clone());
|
||||
}
|
||||
None => {
|
||||
error!(
|
||||
"{}'s formatter failed: unknown formatter error",
|
||||
&formatter
|
||||
);
|
||||
return (formatter_name.clone(), path_mtime.clone());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
info!(
|
||||
"{}: {} files processed in {:.2?}",
|
||||
formatter.name,
|
||||
|
Loading…
Reference in New Issue
Block a user