Terminal state not fully restored on exit (Ctrl+D broken in Ghostty)
Resolved 💬 3 comments Opened Mar 25, 2026 by capocasa Closed Mar 26, 2026
Bug description
After exiting Claude Code, Ctrl+D (EOF) stops working in the Ghostty terminal. The cat > /dev/null test confirms the terminal is not receiving the character at all — cat blocks instead of exiting on Ctrl+D.
Environment
- Terminal: Ghostty (latest, Linux)
- OS: Arch Linux (kernel 6.19.5-3-cachyos)
- Shell: bash
- Claude Code model: claude-opus-4-6
Steps to reproduce
- Open Ghostty terminal
- Verify Ctrl+D works (e.g.
cat > /dev/nullthen Ctrl+D — cat exits) - Run
claudeand use it normally - Exit Claude Code
- Try Ctrl+D — it no longer works
cat > /dev/nullthen Ctrl+D — cat blocks, confirming the terminal isn't sending the character
Investigation
stty -ashowseof = ^Dis correctly set — the shell config is finestty sanedoes not fix it- Disabling kitty keyboard protocol (
printf '\e[<u') does not fix it reset(full terminal reinitialization) does fix it
This suggests Claude Code is leaving some terminal mode enabled on exit that prevents Ghostty from sending Ctrl+D as EOF. It's not the kitty keyboard protocol and not stty settings — it's some other terminal escape sequence state.
Workaround
Run reset after exiting Claude Code:
alias claude='claude; reset'
Downside: reset clears the screen.
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗