fix: use awk instead of grep -Eo in smoke test for Alpine compatibility (#296)
busybox grep on Alpine handles ERE character classes [(][)] differently from GNU grep, causing get_fns to miss function definitions like handle_ci_exhaustion(). awk is portable and works identically on all platforms. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
809dd93c3b
commit
268ddc398c
1 changed files with 6 additions and 2 deletions
|
|
@ -18,10 +18,14 @@ FAILED=0
|
|||
# ── helpers ─────────────────────────────────────────────────────────────────
|
||||
|
||||
# Extract function names defined in a bash script (top-level or indented).
|
||||
# Uses awk instead of grep -Eo for busybox/Alpine compatibility (#296).
|
||||
get_fns() {
|
||||
local f="$1"
|
||||
grep -Eo '[a-zA-Z_][a-zA-Z0-9_]+[[:space:]]*[(][)]' "$f" 2>/dev/null \
|
||||
| sed 's/[[:space:]]*()//' | sort -u || true
|
||||
awk '/^[[:space:]]*[a-zA-Z_][a-zA-Z0-9_]+[[:space:]]*\(\)/ {
|
||||
sub(/^[[:space:]]+/, "")
|
||||
sub(/[[:space:]]*\(\).*/, "")
|
||||
print
|
||||
}' "$f" 2>/dev/null | sort -u || true
|
||||
}
|
||||
|
||||
# Extract call-position identifiers that look like custom function calls:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue