From b1f238a024dac91c3606eb697f620502f5193076 Mon Sep 17 00:00:00 2001 From: alexbelgium Date: Mon, 27 Jul 2026 11:24:05 +0200 Subject: [PATCH] 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 --- .templates/00-global_var.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.templates/00-global_var.sh b/.templates/00-global_var.sh index 9e111d15f1..711c65c82d 100755 --- a/.templates/00-global_var.sh +++ b/.templates/00-global_var.sh @@ -139,7 +139,7 @@ if [[ "${1:-}" == "--self-test" ]]; then printf 'DOTENVTEST_%s=%s\n' \ "$self_test_i" "$(dotenv_quote "${self_test_values[$self_test_i]}")" 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 # abort the sourcing shell instead of just yielding a wrong value. echo "FAIL (dotenv): generated env file is not valid shell"