From 318b00e4372aae881bdd41adac56613f6b13661f Mon Sep 17 00:00:00 2001 From: Andrew Hlynskyi Date: Fri, 11 Jun 2021 08:22:08 +0300 Subject: [PATCH] fix(cli): Don't print 'Error:' prefix --- cli/src/main.rs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/cli/src/main.rs b/cli/src/main.rs index 5c39190b..353cc8a8 100644 --- a/cli/src/main.rs +++ b/cli/src/main.rs @@ -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::() { 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<()> {