fix(scripts): Fix awk env parsing for POSIX compatibility
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
- Use index() instead of regex capture groups for key extraction - More portable across different awk implementations Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1478,16 +1478,18 @@ write_env_with_overrides() {
|
|||||||
while ((getline < overrides_file) > 0) {
|
while ((getline < overrides_file) > 0) {
|
||||||
line = $0
|
line = $0
|
||||||
if (line ~ /^[A-Za-z0-9_]+=*/) {
|
if (line ~ /^[A-Za-z0-9_]+=*/) {
|
||||||
key = substr(line, 1, index(line, "=") - 1)
|
eq = index(line, "=")
|
||||||
value = substr(line, index(line, "=") + 1)
|
key = substr(line, 1, eq - 1)
|
||||||
|
value = substr(line, eq + 1)
|
||||||
map[key] = value
|
map[key] = value
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
close(overrides_file)
|
close(overrides_file)
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
if (match($0, /^([A-Za-z0-9_]+)=/, m)) {
|
if ($0 ~ /^[A-Za-z0-9_]+=/) {
|
||||||
key = m[1]
|
eq = index($0, "=")
|
||||||
|
key = substr($0, 1, eq - 1)
|
||||||
if (key in map) {
|
if (key in map) {
|
||||||
print key "=" map[key]
|
print key "=" map[key]
|
||||||
used[key] = 1
|
used[key] = 1
|
||||||
|
|||||||
Reference in New Issue
Block a user