set up coredump

This commit is contained in:
Clément DOUIN 2023-07-13 15:39:41 +02:00
parent e821fe06d9
commit 2f4bbcb1db
No known key found for this signature in database
GPG key ID: 353E4A18EE0FAB72
3 changed files with 18 additions and 0 deletions

10
Cargo.lock generated
View file

@ -439,6 +439,15 @@ version = "0.8.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5827cebf4670468b8772dd191856768aedcb1b0278a04f989f7766351917b9dc"
[[package]]
name = "coredump"
version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c7b12ca865ce2c375a629bc88221bdcdfaf9bdf6d8e966d7a6dbd2f6c4ceb335"
dependencies = [
"libc",
]
[[package]]
name = "cpufeatures"
version = "0.2.7"
@ -1006,6 +1015,7 @@ dependencies = [
"clap_complete",
"clap_mangen",
"console",
"coredump",
"dialoguer",
"dirs",
"email_address",

View file

@ -36,6 +36,7 @@ clap = "4.0"
clap_complete = "4.0"
clap_mangen = "0.2"
console = "0.15.2"
coredump = "=0.1.2"
dialoguer = "0.10.2"
dirs = "4.0.0"
email_address = "0.2.4"

View file

@ -1,5 +1,7 @@
use anyhow::{anyhow, Context, Result};
use clap::Command;
use coredump::register_panic_handler;
use log::{debug, warn};
#[cfg(feature = "imap-backend")]
use pimalaya_email::backend::ImapBackend;
use pimalaya_email::{
@ -47,6 +49,11 @@ fn create_app() -> Command {
#[allow(clippy::single_match)]
#[tokio::main]
async fn main() -> Result<()> {
if let Err((_, err)) = register_panic_handler() {
warn!("cannot register custom panic handler: {err}");
debug!("cannot register custom panic handler: {err:?}");
}
let default_env_filter = env_logger::DEFAULT_FILTER_ENV;
env_logger::init_from_env(env_logger::Env::default().filter_or(default_env_filter, "off"));