cleanup_release left through a bare return when the release was no longer owned by the run or did not exist. Inside a trap handler bash gives a bare return the status of the last command executed before the trap, which for recovery is the command that failed. So recover read "nothing to remove" as a failed cleanup, printed cleanup_ok=0 and exited 90 in place of the failure's own code, for every failure after the new program had been started. Seen as tests/release-server.test.ts failing on bash 5.2.37 in the scenario "a start attempt may write durable data": deployment_failed=1 phase=starting cleanup_ok=0, exit 90 where 1 is expected. A four-line script shows the rule alone: a function that leaves by a bare return gives 0 when called directly and 1 when called from an EXIT trap after `false`. Every early exit of cleanup_stage and cleanup_release now states its status. The test's stand-ins for readlink, ln and mv return the status of the command they ran, for the same reason: recover reads ln's and mv's.
4dbfd8157f
·
2026-11-29 23:18:01 +08:00
History