Merge pull request #35266 from abbradar/cc-bools
cc-wrapper: fix bool handling for empty and zero values
This commit is contained in:
commit
e42e6d2f0e
|
@ -25,7 +25,11 @@ mangleVarBool() {
|
||||||
for infix in "${role_infixes[@]}"; do
|
for infix in "${role_infixes[@]}"; do
|
||||||
local inputVar="${var/+/${infix}}"
|
local inputVar="${var/+/${infix}}"
|
||||||
if [ -v "$inputVar" ]; then
|
if [ -v "$inputVar" ]; then
|
||||||
let "${outputVar} |= ${!inputVar}"
|
# "1" in the end makes `let` return success error code when
|
||||||
|
# expression itself evaluates to zero.
|
||||||
|
# We don't use `|| true` because that would silence actual
|
||||||
|
# syntax errors from bad variable values.
|
||||||
|
let "${outputVar} |= ${!inputVar:-0}" "1"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue