From cffa44d4d495f6f1403418c3d0ccccec1307fe43 Mon Sep 17 00:00:00 2001 From: Jeremiah Russell Date: Thu, 2 Oct 2025 16:42:06 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20fix(main):=20exit=20process=20wi?= =?UTF-8?q?th=20error=20code=20on=20failure?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - exit the process with a non-zero error code when the `run` function returns an error - this ensures that the program signals failure to the operating system - only log messages from `cull_gmail` --- src/main.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/main.rs b/src/main.rs index 9b10074..bb97fa4 100644 --- a/src/main.rs +++ b/src/main.rs @@ -30,8 +30,8 @@ async fn main() { logging.init(); log::info!("Logging started."); - match run(args).await { - Ok(_) => {} + std::process::exit(match run(args).await { + Ok(_) => 0, Err(e) => { if let Some(src) = e.source() { log::error!("{e}: {src}"); @@ -40,9 +40,9 @@ async fn main() { log::error!("{e}"); eprintln!("{e}"); } - std::process::exit(101); + 101 } - } + }); } async fn run(args: Cli) -> Result<(), Error> { @@ -63,7 +63,7 @@ fn get_logging(level: log::LevelFilter) -> env_logger::Builder { let mut builder = env_logger::Builder::new(); - builder.filter(None, level); + builder.filter(Some("cull_gmail"), level); builder.format_timestamp_secs().format_module_path(false);