Skip to main content

install_panic_hook

Function install_panic_hook 

Source
pub fn install_panic_hook()
Expand description

Install a panic hook that restores the terminal state before the default panic handler prints. Safe to call once at process start.

The hook is gated on RATATUI_ACTIVE so it only calls ratatui::restore() when a ratatui terminal is actually in use — avoiding spurious restores for non-TTY panics (pipes, redirects, CI). TerminalGuard in display.rs sets and clears this flag.

default(info) chains to the original hook, which prints the panic message and respects RUST_BACKTRACE — so backtrace behaviour is preserved.