From 676f2791834b5b80270c563cf86c471446d9f854 Mon Sep 17 00:00:00 2001 From: Don Isaac Date: Tue, 8 Oct 2024 16:19:15 -0400 Subject: [PATCH] fix: double print of finish message on errors --- src/main.rs | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/src/main.rs b/src/main.rs index 3e46515..8b091f7 100644 --- a/src/main.rs +++ b/src/main.rs @@ -4,7 +4,7 @@ mod options; mod reporter; mod walk; -use std::{thread, time::Instant}; +use std::{process::ExitCode, thread, time::Instant}; extern crate pretty_env_logger; #[macro_use] @@ -18,7 +18,7 @@ use crate::{ }; #[allow(clippy::print_stdout)] -fn main() -> Result<()> { +fn main() -> Result { pretty_env_logger::init(); let matches = cli(); let opts = CliOptions::new(matches).and_then(OxbuildOptions::new)?; @@ -47,14 +47,12 @@ fn main() -> Result<()> { "Finished in {:2}ms with {num_errors} errors and {num_warnings} warnings using {num_threads} threads.", duration.as_millis() ); + } else { + println!( + "Finished in {:2}ms using {num_threads} threads.", + duration.as_millis() + ); } - println!( - "Finished in {:2}ms using {num_threads} threads.", - duration.as_millis() - ); - if did_fail { - std::process::exit(1); - } - Ok(()) + Ok(ExitCode::from(u8::from(did_fail))) }