feat: add --yes support to teardown scripts

This commit is contained in:
S
2026-03-02 11:32:01 -05:00
parent 57ceae3bd5
commit 62c9e0f2bb
11 changed files with 315 additions and 71 deletions

View File

@@ -70,12 +70,6 @@ if [[ "$AUTO_YES" == "false" ]]; then
fi
fi
# ---------------------------------------------------------------------------
# Export YES=true so individual teardown scripts skip their own prompts
# when --yes is passed. Each teardown script checks for interactive input,
# but when called from here with --yes, we pipe 'y' to them instead.
# ---------------------------------------------------------------------------
# Teardown scripts in reverse order (9 → 1)
# Each entry: phase_num|script_path
TEARDOWNS=(
@@ -105,12 +99,8 @@ for entry in "${TEARDOWNS[@]}"; do
log_info ">>> Tearing down Phase ${phase_num}..."
if [[ "$AUTO_YES" == "true" ]]; then
# Feed unlimited 'y' responses via process substitution.
# A pipeline (yes | script) would break under pipefail: when the script
# finishes and closes stdin, `yes` gets SIGPIPE (exit 141), making the
# pipeline report failure even though the teardown succeeded.
# Process substitution avoids this — only the script's exit code matters.
if "${SCRIPT_DIR}/${script}" < <(yes); then
# Pass --yes through to each teardown script so prompts are skipped.
if "${SCRIPT_DIR}/${script}" --yes; then
PASS=$((PASS + 1))
else
log_warn "Phase ${phase_num} teardown had issues (continuing)"