fix: handle file paths with spaces

xargs split paths on whitespace, so sed failed on files like
'..._Removed MediaType Enum.cs' (exit 123). Pass the file list
NUL-separated and only rewrite files containing {{BUILD_VAR_.
A repo without any placeholder no longer fails on grep's exit 1.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
UltimateCoderandClaude Opus 5.5 committed 2026-10-15 22:03:00 +02:00
1 parent 8576b6a01b
commit b7cbbe7b7b
1 file changed
+6 -1
+6 -1
View File
@@ -50,4 +50,9 @@ runs:
SED_ARGS+=(-e "s|{{${key}}}|${VARS[$key]}|g")
done
grep -rIl --exclude-dir=.git '' . | xargs -r sed -i "${SED_ARGS[@]}"
# NUL-separated so paths with spaces survive; only touch files that contain placeholders.
# grep exits 1 when nothing matches, which is fine; 2 (real error) still fails.
FILES="$(mktemp)"
grep -rIlZ --exclude-dir=.git -F '{{BUILD_VAR_' . > "$FILES" || [ $? -eq 1 ]
xargs -0 -r sed -i "${SED_ARGS[@]}" < "$FILES"
rm -f "$FILES"