Merge pull request #1163 from ahlinc/fix/error-prefix

fix(cli): Don't print 'Error:' prefix
This commit is contained in:
Max Brunsfeld 2021-06-14 08:09:29 -07:00 committed by GitHub
commit 12207c1f70
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -12,17 +12,20 @@ use tree_sitter_loader as loader;
const BUILD_VERSION: &'static str = env!("CARGO_PKG_VERSION");
const BUILD_SHA: Option<&'static str> = option_env!("BUILD_SHA");
fn main() -> Result<()> {
fn main() {
let result = run();
// Ignore BrokenPipe errors
if let Err(err) = &result {
// Ignore BrokenPipe errors
if let Some(error) = err.downcast_ref::<std::io::Error>() {
if error.kind() == std::io::ErrorKind::BrokenPipe {
return Ok(());
return;
}
}
if !err.to_string().is_empty() {
eprintln!("{:?}", err);
}
std::process::exit(1);
}
result
}
fn run() -> Result<()> {