Skip to content

Commit

Permalink
Return correct error code
Browse files Browse the repository at this point in the history
  • Loading branch information
marlonbaeten committed Mar 14, 2023
1 parent efdf0dc commit 78ac182
Showing 1 changed file with 14 additions and 7 deletions.
21 changes: 14 additions & 7 deletions backend/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use std::{
collections::HashMap,
convert::Infallible,
env,
sync::{Arc, RwLock},
sync::{Arc, RwLock}, process,
};
use tokio::sync::broadcast::{Receiver, Sender};
use tokio::time::Duration;
Expand Down Expand Up @@ -137,13 +137,20 @@ async fn main() {
.handle_shutdown_requests(Duration::from_millis(5000))
.await;

if let Err(e) = result {
event!(Level::ERROR, "MailCrab error {e}");
} else {
event!(Level::INFO, "Thank you for using MailCrab!");
}
let exit_code = match result {
Err(e) => {
event!(Level::ERROR, "MailCrab error {e}");
// failure
1
}
_ => {
event!(Level::INFO, "Thank you for using MailCrab!");
// success
0
}
};

std::process::exit(0);
process::exit(exit_code);
}

#[cfg(test)]
Expand Down

0 comments on commit 78ac182

Please sign in to comment.