Skip to content

Make build phase error handling portable - #68

Merged
jhuntwork merged 1 commit into
mainfrom
portable-build-phase-trap
Oct 31, 2026
Merged

jhuntwork merged 1 commit into
mainfrom
portable-build-phase-trap

Conversation

@jhuntwork

Copy link
Copy Markdown
Owner

Build phases fail before executing on shells such as Dash because /bin/sh does not universally support ERR traps. Use a portable exit trap that starts the debug shell only on failure and preserves the phase's original exit status, even if the debug shell exits unsuccessfully.

Validated with Zig 0.16.0: zig build test --summary all reports 758 passed, 22 skipped, and zero failures. Checked success, command failure, and explicit nonzero exit under Dash and Bash; successful phases skip the handler and failing phases retain their status. Full isolated package builds remain unverified.

Build phases run under /bin/sh, where ERR traps are not universally supported. Use an exit trap so shells such as Dash can run phases while preserving failure status after the debug shell exits.
@jhuntwork
jhuntwork merged commit c2994b0 into main Oct 31, 2026
2 checks passed
@jhuntwork
jhuntwork deleted the portable-build-phase-trap branch October 31, 2026 20:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant