Skip to content

fix(cli): report a bootstrap that never finished loading - #1180

Merged
Chemaclass merged 1 commit into
mainfrom
fix/1179-bootstrap-failure-silent
Aug 13, 2026
Merged

fix(cli): report a bootstrap that never finished loading#1180
Chemaclass merged 1 commit into
mainfrom
fix/1179-bootstrap-failure-silent

Conversation

@Chemaclass

Copy link
Copy Markdown
Member

🤔 Background

Related #1179

A bootstrap that fails to load leaves the run with no tests, no summary and
exit 0
— CI passes having executed nothing:

$ BASHUNIT_BOOTSTRAP=boot.sh bashunit tests/
boot.sh: line 1: syntax error near unexpected token `{'
$ echo $?
0

[ -f ] && source cannot catch it: source is a POSIX special builtin, so
a syntax error or a bare exit ends the shell at that point and nothing after
the call runs. The --env/--boot flag path already validated its file (#875);
the env-var path never did.

💡 Changes

  • Marker set before sourcing and cleared after; the existing EXIT trap reports one that was never cleared, covering both failure modes
  • Chosen over bash -n pre-validation, which costs an interpreter fork on every invocation — capped at 1 by bashunit_coldstart_forks_test.sh, and this repo has a bootstrap, so ~258 nested acceptance runs would pay it (fork budget tests still 11/11)
  • An absent bootstrap stays silent: the default path is one most projects do not have

A bootstrap that fails to load left the run with no tests, no summary and
exit 0, so CI passed having executed nothing. A bare 'exit' in the file was
worse: entirely silent.

[ -f ] && source cannot catch this. source is a POSIX special builtin, so a
syntax error in the file, or an exit, terminates the shell at that point --
'|| status=$?' never runs and nothing after the call executes. The --env/--boot
flag path already validated its file (#875); the env-var path never did.

bash -n would catch it but costs an interpreter fork on every invocation, which
the cold-start budget caps at 1, and this repo has a bootstrap -- all ~258
nested acceptance runs would pay it. Leave a marker instead and let the EXIT
trap report one that was never cleared: fork-free, and it covers both failure
modes.

An absent bootstrap stays silent: BASHUNIT_BOOTSTRAP defaults to
tests/bootstrap.sh, which most projects do not have.

Closes #1179
@Chemaclass Chemaclass added the bug Something isn't working label Aug 13, 2026
@Chemaclass Chemaclass self-assigned this Aug 13, 2026
@Chemaclass
Chemaclass merged commit d0ebfec into main Aug 13, 2026
37 checks passed
@Chemaclass
Chemaclass deleted the fix/1179-bootstrap-failure-silent branch August 13, 2026 22:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant