[Bug] zsh shell snapshot writes bare option names; `login` executes /usr/bin/login causing hangs
Bug Description
Title: zsh shell snapshot writes bare option names; login line runs /usr/bin/login and hangs every shell command
Environment
- Claude Code 2.1.288 (latest) and 2.1.285 (stable), native install, clean reinstall
- macOS [version], darwin-arm64, zsh 5.9 (x86_64-apple-darwin23.0)
Symptom
Every Bash tool call (even ls) hangs at "Running…" indefinitely. Running the
same commands in a terminal works instantly.
Diagnosis
While hung, the wrapper process has a child login (/usr/bin/login) waiting on stdin:
70006 ... /bin/zsh -c source ~/.claude/shell-snapshots/snapshot-zsh-....sh 2>/dev/null || true && ... eval 'make -k 2>&1 | tail -80' < /dev/null ...
70007 70006 login
Sourcing the snapshot manually shows option names and aliases written as bare
lines, without their setopt/alias prefixes:
snapshot-zsh-....sh:225: command not found: promptsubst
snapshot-zsh-....sh:234: command not found: run-help=man
snapshot-zsh-....sh:236: command not found: which-command=whence
The login option (set for login shells) ends up as a bare login line, which
executes /usr/bin/login. Only the user command gets < /dev/null, not thesource step, so login blocks on stdin forever.
Relevant snapshot lines:
~ % time zsh -c 'source ~/.claude/shell-snapshots/snapshot-zsh-1791040501653-la0bdt.sh' < /dev/null
login: /Users/theodor/.claude/shell-snapshots/snapshot-zsh-1791040501653-la0bdt.sh:225: command not found: promptsubst
/Users/theodor/.claude/shell-snapshots/snapshot-zsh-1791040501653-la0bdt.sh:234: command not found: run-help=man
/Users/theodor/.claude/shell-snapshots/snapshot-zsh-1791040501653-la0bdt.sh:236: command not found: which-command=whence
zsh -c 'source ~/.claude/shell-snapshots/snapshot-zsh-1791040501653-la0bdt.sh 0.00s user 0.02s system 77% cpu 0.026 total
Workaround
CLAUDE_CODE_SHELL=/bin/bash in ~/.claude/settings.json env.
Suggested fixes
- Prefix each captured option with
setopt(and each alias withalias) when writing the snapshot - Source the snapshot with stdin redirected from /dev/null
Environment Info
- Platform: darwin
- Terminal: iTerm.app
- Version: 2.1.285
- Feedback ID: a7dc2570-8bab-4610-af35-6a0e6524bfb2
Errors
[]