From 38fe84abcf4f26aab40b06d2b901d4ee8ba83dcb Mon Sep 17 00:00:00 2001 From: Ian Douglas Scott Date: Tue, 5 Aug 2025 10:28:36 -0700 Subject: [PATCH] Log error return from `main()` with `tracing` Previously this was printed to `stderr`, but not written to journald. --- src/main.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/main.rs b/src/main.rs index 033ccd2a..9cf2f19c 100644 --- a/src/main.rs +++ b/src/main.rs @@ -99,7 +99,14 @@ impl State { } } -fn main() -> Result<(), Box> { +fn main() { + if let Err(err) = main_inner() { + error!("Error occured in main(): {}", err); + process::exit(1); + } +} + +fn main_inner() -> Result<(), Box> { let raw_args = RawArgs::from_args(); let mut cursor = raw_args.cursor(); let git_hash = option_env!("GIT_HASH").unwrap_or("unknown");