mirror of
https://github.com/alexbelgium/hassio-addons.git
synced 2026-08-16 18:12:29 +02:00
fix(templates): don't swallow bash -n's parse error in --self-test
Keep stderr from the dotenv env-file validation so a failure shows which line broke instead of just "not valid shell". Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -139,7 +139,7 @@ if [[ "${1:-}" == "--self-test" ]]; then
|
|||||||
printf 'DOTENVTEST_%s=%s\n' \
|
printf 'DOTENVTEST_%s=%s\n' \
|
||||||
"$self_test_i" "$(dotenv_quote "${self_test_values[$self_test_i]}")"
|
"$self_test_i" "$(dotenv_quote "${self_test_values[$self_test_i]}")"
|
||||||
done > "$self_test_env"
|
done > "$self_test_env"
|
||||||
if ! bash -n "$self_test_env" 2>/dev/null; then
|
if ! bash -n "$self_test_env"; then
|
||||||
# An unescaped backtick or quote leaves the file unparseable, which would
|
# An unescaped backtick or quote leaves the file unparseable, which would
|
||||||
# abort the sourcing shell instead of just yielding a wrong value.
|
# abort the sourcing shell instead of just yielding a wrong value.
|
||||||
echo "FAIL (dotenv): generated env file is not valid shell"
|
echo "FAIL (dotenv): generated env file is not valid shell"
|
||||||
|
|||||||
Reference in New Issue
Block a user