Problem
Console mode changes apply to the current Python process. If unleashed crashes (segfault in ctypes, pywinpty panic), the console is left in raw mode. User terminal behaves weirdly: no echo, no line editing.
There's a try/finally to restore, but it won't work if Python segfaults.
Impact
Terminal is unusable until manually reset (reset or new terminal).
Recommendation
- Register an atexit handler as backup
- Consider writing original console mode to a temp file so a recovery script can restore it
- Add a
--reset-terminal flag that just restores console mode and exits
Source
Deep audit (2026-02-12).