fix: discard-dist-on-failure keeps the step's status when its message cannot be written (closes #342)
check / check (push) Waiting to run
e2e / e2e-chrome (push) Waiting to run
e2e / e2e-firefox (push) Waiting to run

With stderr closed, the wrapper's message write failed and set -e ended it
with status 2; with stderr a pipe whose reader had gone, the write killed it
with 141. Either replaced the failed step's own status. The message is now
written with SIGPIPE ignored and its failure ignored, after the step has run,
so the step still sees the default SIGPIPE. The header now states that an
interrupt removes nothing (it is not a build failure) and that a failed
check-censored --require-dist removes dist/ (a dist/ not cleared of the barred
name must not ship); neither behaviour changed. Also the README bullet's
missing period.

Model: opus-5-5
This commit is contained in:
2026-10-07 00:32:06 +00:00
parent e14f6e9eb5
commit 9f8eb0398c
4 changed files with 44 additions and 17 deletions
+16
View File
@@ -915,6 +915,22 @@ run_cases() {
discard_case "the wrapper given no command removes nothing" \
c_control 1 kept "no command given" ""
# With stderr closed the wrapper cannot write its message, and must still
# remove dist/ and return the step's own status.
build_fixture
_status=0
(cd "$FIXTURE" &&
"$FIXTURE/script/discard-dist-on-failure" sh -c 'exit 6' 2>&-) ||
_status=$?
if [ "$_status" -eq 6 ] && [ ! -e "$FIXTURE/dist" ]; then
PASSED=$((PASSED + 1))
echo " ok: a failed step's status survives a closed stderr"
else
FAILED=$((FAILED + 1))
echo " FAIL: a failed step's status survives a closed stderr"
echo " exit status $_status, wanted 6, and dist/ must be gone"
fi
check_makefile_wiring
}