Terminal state not fully restored on exit (Ctrl+D broken in Ghostty)
Status Fixed / completed
Maintainer reply None cached
Workaround ✓ Mentioned in thread ↓
Activity 3 comments · opened Mar 25, 2026 · 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.
3 Comments
Found 3 possible duplicate issues:
This issue will be automatically closed as a duplicate in 3 days.
🤖 Generated with Claude Code
Less drastic workaround
This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.