fix(runner): detect set_up failure when source file does not exist#612
Merged
Chemaclass merged 1 commit intomainfrom Mar 19, 2026
Merged
Conversation
Contributor
✅ Contributor ReportUser: @Chemaclass This user is on the trusted contributors list and was automatically approved. |
6a0949c to
c4a2cf0
Compare
) When `source` of a non-existent file fails under `set -eE` in a hook, the ERR trap does not fire and bash exits the subshell with a leaked stdout redirect, causing `export_subshell_context` output to be lost. This made all tests silently pass. Fix by saving the subshell's stdout to FD 5 and restoring it in the EXIT trap, plus using a sentinel variable to detect unexpected exit during set_up when $? is incorrectly 0.
c4a2cf0 to
4ec3d90
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #611
sourceof non-existent file inset_up()silently passing all testsexport_subshell_contextoutput_BASHUNIT_SETUP_COMPLETEDto detect unexpected exit during set_up when$?is incorrectly 0Root cause
When
sourceof a non-existent file fails underset -eE(as used byexecute_test_hook):set -ekills the subshell, but the{ hook } >file 2>&1redirect fromexecute_test_hookleaks into the EXIT trapexport_subshell_contextoutput goes to the hook output file instead of stdouttest_execution_resultis empty → no failures detected → test silently passes