fix: guard-write hook uses portable bash timeout
The hook was blocking because `timeout` is a GNU coreutil only available via homebrew on macOS. Replaced with bash's built-in `read -t 2` which is portable and doesn't require PATH setup. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
d7db9c667d
commit
29ccd4082f
2 changed files with 22 additions and 2 deletions
|
|
@ -2,7 +2,17 @@
|
||||||
# Managed by: blue install
|
# Managed by: blue install
|
||||||
# Blue PreToolUse hook - enforces RFC 0038 worktree protection
|
# Blue PreToolUse hook - enforces RFC 0038 worktree protection
|
||||||
|
|
||||||
FILE_PATH=$(jq -r '.tool_input.file_path // empty')
|
# Read stdin with bash timeout (portable, no GNU timeout needed)
|
||||||
|
INPUT=""
|
||||||
|
while IFS= read -t 2 -r line; do
|
||||||
|
INPUT="${INPUT}${line}"
|
||||||
|
done
|
||||||
|
|
||||||
|
if [ -z "$INPUT" ]; then
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
FILE_PATH=$(echo "$INPUT" | jq -r '.tool_input.file_path // empty' 2>/dev/null || echo "")
|
||||||
|
|
||||||
if [ -z "$FILE_PATH" ]; then
|
if [ -z "$FILE_PATH" ]; then
|
||||||
exit 0
|
exit 0
|
||||||
|
|
|
||||||
|
|
@ -2744,7 +2744,17 @@ const GUARD_WRITE_HOOK: &str = r#"#!/bin/bash
|
||||||
# Managed by: blue install
|
# Managed by: blue install
|
||||||
# Blue PreToolUse hook - enforces RFC 0038 worktree protection
|
# Blue PreToolUse hook - enforces RFC 0038 worktree protection
|
||||||
|
|
||||||
FILE_PATH=$(jq -r '.tool_input.file_path // empty')
|
# Read stdin with bash timeout (portable, no GNU timeout needed)
|
||||||
|
INPUT=""
|
||||||
|
while IFS= read -t 2 -r line; do
|
||||||
|
INPUT="${INPUT}${line}"
|
||||||
|
done
|
||||||
|
|
||||||
|
if [ -z "$INPUT" ]; then
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
FILE_PATH=$(echo "$INPUT" | jq -r '.tool_input.file_path // empty' 2>/dev/null || echo "")
|
||||||
|
|
||||||
if [ -z "$FILE_PATH" ]; then
|
if [ -z "$FILE_PATH" ]; then
|
||||||
exit 0
|
exit 0
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue