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

  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 ↗

This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗