forked from DevComp/ssh-portfolio
feat: prevent panics by exiting only in dev mode
This commit is contained in:
parent
8c9932fe2b
commit
6a3597002c
1 changed files with 3 additions and 8 deletions
|
@ -15,12 +15,6 @@ pub fn init() -> Result<()> {
|
||||||
.into_hooks();
|
.into_hooks();
|
||||||
eyre_hook.install()?;
|
eyre_hook.install()?;
|
||||||
std::panic::set_hook(Box::new(move |panic_info| {
|
std::panic::set_hook(Box::new(move |panic_info| {
|
||||||
// if let Ok(mut t) = crate::tui::Tui::new() {
|
|
||||||
// if let Err(r) = t.exit() {
|
|
||||||
// error!("Unable to exit Terminal: {:?}", r);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
#[cfg(not(debug_assertions))]
|
#[cfg(not(debug_assertions))]
|
||||||
{
|
{
|
||||||
use human_panic::{handle_dump, metadata, print_msg};
|
use human_panic::{handle_dump, metadata, print_msg};
|
||||||
|
@ -43,10 +37,11 @@ pub fn init() -> Result<()> {
|
||||||
.lineno_suffix(true)
|
.lineno_suffix(true)
|
||||||
.verbosity(better_panic::Verbosity::Full)
|
.verbosity(better_panic::Verbosity::Full)
|
||||||
.create_panic_handler()(panic_info);
|
.create_panic_handler()(panic_info);
|
||||||
}
|
|
||||||
|
|
||||||
std::process::exit(libc::EXIT_FAILURE);
|
std::process::exit(libc::EXIT_FAILURE);
|
||||||
|
}
|
||||||
}));
|
}));
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue