Skip to content

fix: POSIX compatibility and exit code handling in hooks#16

Merged
raisedadead merged 4 commits intomainfrom
fix/hooks
Feb 5, 2026
Merged

fix: POSIX compatibility and exit code handling in hooks#16
raisedadead merged 4 commits intomainfrom
fix/hooks

Conversation

@raisedadead
Copy link
Copy Markdown
Owner

Summary

Make bundled hooks POSIX-compatible and fix exit code handling bugs.

Changes

All files in internal/hooks/bundled/:

  • #!/bin/bash#!/bin/sh
  • [[ ]][ ]
  • source.
  • &>/dev/null>/dev/null 2>&1
  • Fixed exit code handling in github-issue.sh and github-pr.sh
  • Added WT_OUTPUT guards to helpers.sh

Files Modified

  • helpers.sh
  • github-issue.sh
  • github-pr.sh
  • direnv.sh
  • gh-default.sh
  • zoxide.sh
  • embed_test.go (updated to accept POSIX syntax)

Test plan

  • go build ./... passes
  • go test ./internal/hooks/... passes
  • Manual test: Hooks work on systems with only /bin/sh

🤖 Generated with Claude Code

raisedadead and others added 4 commits February 5, 2026 16:29
- Change shebang from #!/bin/bash to #!/bin/sh for all bundled hooks
- Replace bash-specific syntax with POSIX equivalents:
  - [[ ]] -> [ ]
  - source -> .
  - &>/dev/null -> >/dev/null 2>&1
  - read -p -> printf + read
- Fix exit code handling in github-issue.sh and github-pr.sh by using
  if ! var=$(cmd); then pattern instead of separate $? check
- Add WT_OUTPUT guards to helpers.sh functions that write to $WT_OUTPUT
- Update tests to accept both POSIX sh and bash shebangs

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@raisedadead raisedadead merged commit af6b109 into main Feb 5, 2026
3 checks passed
@raisedadead raisedadead deleted the fix/hooks branch February 5, 2026 14:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant