Terminal state not fully restored on exit (Ctrl+D broken in Ghostty)

Status Fixed / completed
Maintainer reply None cached
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

  1. Open Ghostty terminal
  2. Verify Ctrl+D works (e.g. cat > /dev/null then Ctrl+D — cat exits)
  3. Run claude and use it normally
  4. Exit Claude Code
  5. Try Ctrl+D — it no longer works
  6. cat > /dev/null then Ctrl+D — cat blocks, confirming the terminal isn't sending the character

Investigation

  • stty -a shows eof = ^D is correctly set — the shell config is fine
  • stty sane does 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.

View original on GitHub ↗

3 Comments

github-actions[bot] · 5 months ago

Found 3 possible duplicate issues:

  1. https://github.com/anthropics/claude-code/issues/38647
  2. https://github.com/anthropics/claude-code/issues/38625
  3. https://github.com/anthropics/claude-code/issues/38609

This issue will be automatically closed as a duplicate in 3 days.

  • If your issue is a duplicate, please close it and 👍 the existing issue instead
  • To prevent auto-closure, add a comment or 👎 this comment

🤖 Generated with Claude Code

dashorst · 5 months ago
github-actions[bot] · 4 months ago

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.