Disable panic hook about reporting issues for debug builds

In order to avoid confusing new developers.  When a debug build panics
chances are that the panic is caused by local changes and should in
fact not be reported on GitHub.
This commit is contained in:
Martin Fischer 2023-01-31 16:10:19 +01:00 committed by Charlie Marsh
parent cd3d82213a
commit 39d98d3488
1 changed files with 11 additions and 8 deletions

View File

@ -58,6 +58,8 @@ fn inner_main() -> Result<ExitCode> {
log_level_args,
} = Args::parse_from(args);
#[cfg(not(debug_assertions))]
{
let default_panic_hook = std::panic::take_hook();
std::panic::set_hook(Box::new(move |info| {
eprintln!(
@ -72,6 +74,7 @@ quoting the executed command, along with the relevant file contents and `pyproje
);
default_panic_hook(info);
}));
}
let log_level: LogLevel = (&log_level_args).into();
set_up_logging(&log_level)?;