diff options
| author | Jesse Vincent <jesse@fsck.com> | 2026-10-22 21:19:08 +0000 |
|---|---|---|
| committer | Jesse Vincent <jesse@fsck.com> | 2026-10-22 21:19:08 +0000 |
| commit | 3cbe5575758e409ac083c694cfc45ccfde50c0cd (patch) | |
| tree | e84d7571f7bbd0665f7f20f61ff18b680e9cdee2 /tests/opencode/test-session-bootstrap.sh | |
| parent | 0f9581f6c1525b51dc1600b14d24f3db1f601446 (diff) | |
fix(hooks): fall back to zsh, or exit quietly, when bash is missing on Unix (#2503)fix/2503-run-hook-no-bash
On a Unix system without bash, the harness can't honour shell:"bash" and
runs run-hook.cmd with zsh or sh. $BASH is unset there, so the wrapper's
exec "${BASH:-bash}" fails with "command not found: bash" (zsh) or
"exec: bash: not found" (sh), the hook exits 127, and the bootstrap is
lost on every session start.
Keep $BASH first, so the empty-PATH case from #2310 still works, then look
for bash on PATH, then zsh, which runs session-start unchanged (its output
is byte-identical to bash's, including for a SKILL.md full of backslashes,
quotes, tabs and CRs). With neither shell, exit 0 quietly, as the Windows
half already does.
Reproduced with Claude Code 2.1.308 in an alpine container with zsh and no
bash: the hook exited 127 and no bootstrap reached the model before the
change; after it the hook exits 0 and the bootstrap arrives.
Tests run the wrapper under real zsh and under a non-bash sh with a PATH
that holds only zsh, and under that sh with neither shell. They skip where
zsh is absent or sh is bash (Git Bash, macOS).
Co-authored-by: Twot <twotnguyen@users.noreply.github.com>
Claude-Session: https://claude.ai/code/session_01SHANcr4A71nzuU9et4Fnba
Diffstat (limited to 'tests/opencode/test-session-bootstrap.sh')
0 files changed, 0 insertions, 0 deletions
