Skip to content

Commit b52ef3b

Browse files
manusaclaude
andauthored
fix(skills): prevent SIGPIPE exit in bump-go-dep context script
The script failed when awk piped through head -60 because awk matched all 211 lines across multiple require blocks. head closed the pipe after 60 lines, causing SIGPIPE (exit 141) under set -euo pipefail. Fix by printing only the first require block in awk, guarding head -40 with || true, and redirecting stderr to stdout to prevent gh CLI warnings from triggering Claude Code error detection. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> Signed-off-by: Marc Nuri <marc@marcnuri.com>
1 parent ddbbc5a commit b52ef3b

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

.claude/skills/bump-go-dep/scripts/get-dep-context.sh

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
# Fetches context for a Dependabot Go dependency bump PR
33
# Usage: get-dep-context.sh <pr-number>
44
set -euo pipefail
5+
# Redirect stderr to stdout so Claude Code doesn't treat gh CLI warnings as errors
6+
exec 2>&1
57

68
PR_NUMBER="${1:?Usage: get-dep-context.sh <pr-number>}"
79
REPO="fabric8io/kubernetes-client"
@@ -14,7 +16,7 @@ gh pr view "$PR_NUMBER" --repo "$REPO" --json number,title,state,headRefName,bod
1416

1517
echo ""
1618
echo "=== PR Body (first 40 lines) ==="
17-
gh pr view "$PR_NUMBER" --repo "$REPO" --json body -q '.body' | head -40
19+
gh pr view "$PR_NUMBER" --repo "$REPO" --json body -q '.body' | head -40 || true
1820

1921
echo ""
2022
echo "=== CI Check Status ==="
@@ -44,7 +46,7 @@ fi
4446

4547
echo ""
4648
echo "=== Current go.mod direct dependencies (first require block) ==="
47-
awk '/^require \(/,/^\)/' "$REPO_ROOT/kubernetes-model-generator/openapi/generator/go.mod" | head -60
49+
awk '/^require \(/{found++} found==1{print} found==1 && /^\)/{exit}' "$REPO_ROOT/kubernetes-model-generator/openapi/generator/go.mod"
4850

4951
echo ""
5052
echo "=== Current replace directives ==="

0 commit comments

Comments
 (0)