WSL interactive mode exits immediately (exit=0) while --print works

Resolved 💬 3 comments Opened Feb 21, 2026 by itsu07 Closed Feb 25, 2026

Summary

Interactive claude exits immediately on WSL Ubuntu with exit=0.
Non-interactive mode (--print) works normally.

Environment

  • Host: Windows
  • Guest: WSL2 Ubuntu
  • Terminal: Windows Terminal
  • Shell: bash
  • Claude Code versions tested: 2.1.50, 2.1.49

Reproduction

claude --version
claude --print "ping"
claude
echo "exit=$?"

Actual behavior

  • claude --print "ping" succeeds.
  • Interactive UI appears briefly, then exits.
  • Exit code is 0.

Expected behavior

Interactive session should remain open and accept input.

Diagnostics

~/.claude/debug/latest shows normal startup flow and no fatal error before exit.

strace indicates stdin/hangup-driven clean shutdown:

strace -ff -tt -e trace=epoll_pwait,read,ioctl,exit_group,kill -o /tmp/cc2.strace claude
grep -nE "EPOLLHUP|exit_group|read\\(0,.*= 0|kill\\(.*, SIGTERM" /tmp/cc2.strace.*

Observed lines include:

  • epoll_pwait(... EPOLLIN|EPOLLHUP ...)
  • read(0, "", 4096) = 0
  • exit_group(0)

Additional notes

  • Browser auth auto-open issue was separately addressed (BROWSER=wslview), but this exit issue persisted.
  • A malformed lock path was seen once (~/.local/state/claude/locks/2.1.49.lock as directory), fixed manually.
  • After lock fix, interactive exit issue still persists with the same exit=0 behavior.

Already tried

  • Restarted Ubuntu and host PC
  • Full Claude config/cache/state cleanup
  • Reinstall
  • Downgrade from 2.1.50 to 2.1.49
  • Running inside tmux
  • Forcing stdio to tty (claude </dev/tty >/dev/tty 2>&1)

If this is a known WSL stdin/TTY interaction issue, please share recommended workaround or patch plan.

View original on GitHub ↗

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