fix: discard-dist-on-failure keeps the step's status when its message cannot be written (closes #342)
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:
@@ -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
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user