mirror of
https://github.com/sharkdp/bat.git
synced 2025-03-15 15:18:45 +00:00
Merge 1455d7d3adce872e9b32ef47674660708f1fae7c into ccb1d78b22181505aa6e6de024f1b3d5762c0182
This commit is contained in:
commit
88db823154
22
src/main.rs
22
src/main.rs
@ -540,9 +540,29 @@ fn run() -> Result<()> {
|
|||||||
})?;
|
})?;
|
||||||
|
|
||||||
if let Some(files) = app_matches.values_of("FILE") {
|
if let Some(files) = app_matches.values_of("FILE") {
|
||||||
|
let mut exit = false;
|
||||||
for file in files {
|
for file in files {
|
||||||
let line_changes = get_git_diff(&file.to_string());
|
let line_changes = get_git_diff(&file.to_string());
|
||||||
print_file(&options, theme, &assets.syntax_set, file, &line_changes)?;
|
let res = print_file(&options, theme, &assets.syntax_set, file, &line_changes);
|
||||||
|
if let Err(error) = res {
|
||||||
|
if match error {
|
||||||
|
Error(ErrorKind::Io(ref io_error), _)
|
||||||
|
if io_error.kind() == io::ErrorKind::BrokenPipe =>
|
||||||
|
{
|
||||||
|
true
|
||||||
|
}
|
||||||
|
_ => {
|
||||||
|
exit = true;
|
||||||
|
eprintln!("{}: {}: {}", Red.paint("[bat error]"), file, error);
|
||||||
|
false
|
||||||
|
}
|
||||||
|
} {
|
||||||
|
return Err(error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if exit {
|
||||||
|
process::exit(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user