Expand description
Write every panic to the log before the process or the task loses it.
A panic inside tokio::spawn is swallowed by the task, and almost everything NetGet does
on behalf of a peer runs inside one. JoinHandle carries the JoinError, but nothing here
awaits those handles — a connection task is spawned and forgotten — so the panic went
nowhere at all. The observable result was the shape recorded three times in the root
CLAUDE.md: the task dies, the server stays Running, the log shows the operation
succeeding, and the peer hangs until its own timeout. block_on inside
UsbInterfaceHandler::handle_urb, blocking_lock() in SMB’s connection task and the
.unwrap()s inside spawned client tasks were all found by reading code, because there was
nothing to grep for.
The only set_hook in the tree before this one lives in the dashboard’s event loop and
restores the terminal. It is installed by the TUI alone, so --mcp, --mcp-http and
non-interactive runs had no hook at all.
This hook is installed from cli::setup::init_logging, which every entry point calls
before doing any work, and it chains to whatever hook it replaced — so the dashboard’s
terminal-restore hook (installed later, over this one, via take_hook) still runs first and
this one still logs.
Functions§
- install
- Install the logging panic hook. Idempotent; safe to call from every entry point.
- payload_
of - Extract a panic payload’s message.