Skip to content

Commit e0f1314

Browse files
Jonathan D.A. Jewellclaude
andcommitted
fix: heredoc install script idempotency — prevent duplicate warning comments
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 40b3f81 commit e0f1314

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

scripts/fix-heredoc-install.sh

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,10 @@ while IFS= read -r -d '' file; do
2626
# Pattern 1: curl | bash / curl | sh (pipe-to-shell)
2727
if grep -qP 'curl\s.*\|\s*(ba)?sh' "$file" 2>/dev/null; then
2828
echo " FOUND curl|bash in $rel_path"
29-
# Add warning comment
30-
sed -i 's/\(.*curl.*|.*sh\)/# WARNING: Pipe-to-shell is unsafe — download and verify first\n\1/' "$file" 2>/dev/null || true
29+
# Add warning comment (idempotent — skip if already annotated)
30+
if ! grep -q "WARNING: Pipe-to-shell is unsafe" "$file" 2>/dev/null; then
31+
sed -i 's/\(.*curl.*|.*sh\)/# WARNING: Pipe-to-shell is unsafe — download and verify first\n\1/' "$file" 2>/dev/null || true
32+
fi
3133
((changes++)) || true
3234
fi
3335

0 commit comments

Comments
 (0)