Skip to content

Commit 38fe84a

Browse files
ids1024Drakulix
authored andcommitted
Log error return from main() with tracing
Previously this was printed to `stderr`, but not written to journald.
1 parent f56ccf0 commit 38fe84a

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/main.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,14 @@ impl State {
9999
}
100100
}
101101

102-
fn main() -> Result<(), Box<dyn Error>> {
102+
fn main() {
103+
if let Err(err) = main_inner() {
104+
error!("Error occured in main(): {}", err);
105+
process::exit(1);
106+
}
107+
}
108+
109+
fn main_inner() -> Result<(), Box<dyn Error>> {
103110
let raw_args = RawArgs::from_args();
104111
let mut cursor = raw_args.cursor();
105112
let git_hash = option_env!("GIT_HASH").unwrap_or("unknown");

0 commit comments

Comments
 (0)