fix: POSIX compatibility and exit code handling in hooks#16
Merged
raisedadead merged 4 commits intomainfrom Feb 5, 2026
Merged
fix: POSIX compatibility and exit code handling in hooks#16raisedadead merged 4 commits intomainfrom
raisedadead merged 4 commits intomainfrom
Conversation
- 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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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>&1github-issue.shandgithub-pr.shWT_OUTPUTguards tohelpers.shFiles Modified
helpers.shgithub-issue.shgithub-pr.shdirenv.shgh-default.shzoxide.shembed_test.go(updated to accept POSIX syntax)Test plan
go build ./...passesgo test ./internal/hooks/...passes/bin/sh🤖 Generated with Claude Code