Skip to content

fix(zb_cli): keep installing the Brewfile when a post-install fails - #495

Merged
cachebag merged 2 commits into
zerobrewhq:mainfrom
thelastbackspace:fix/478-bundle-postinstall-continue
Nov 5, 2026
Merged

cachebag merged 2 commits into
zerobrewhq:mainfrom
thelastbackspace:fix/478-bundle-postinstall-continue

Conversation

@thelastbackspace

Copy link
Copy Markdown
Contributor

Summary

zb bundle install ran each entry with install::execute(...).await?, so a PostInstallFailed from one package (php's configure_php in the issue) ended the whole run even though that package was already installed and linked. Everything after it in the Brewfile got skipped.

Fix

In bundle.rs a PostInstallFailed from an entry is now printed and recorded, and the loop moves on. After the last entry, if any post-install failed the command exits non-zero with post-install did not finish for: <entries>. Any other error (missing formula, network, link conflict, ...) still stops the run like before. I went with stopping on real install failures since that's the current behaviour and the issue said either was fine.

I pulled the decision into a small keep_going_after_post_install helper so it can be unit tested without a real installer.

Testing

  • cargo test -p zb_cli bundle: two new tests, one for a post-install failure being recorded and not stopping the run, one for other errors still propagating
  • cargo clippy -p zb_cli --all-targets -- -D warnings, cargo fmt --check

Fixes #478

cargo test --workspace, cargo clippy --workspace --all-targets -- -D warnings and cargo fmt --all --check all pass.

A failed post-install leaves the package installed, but bundle install
propagated the error with ? and skipped every remaining entry. Report it,
keep going, and fail at the end with the entries whose post-install did
not finish. Any other install error still stops the run.

Fixes zerobrewhq#478
Comment thread zb_cli/src/commands/bundle.rs Resolved
@cachebag cachebag added type: bug something is broken or behaving incorrectly area: install install, uninstall, upgrade, outdated, and migration flows area: cli zb and zbx command-line behavior priority: medium normal priority labels Nov 5, 2026

@cachebag cachebag left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@cachebag
cachebag merged commit cb288c0 into zerobrewhq:main Nov 5, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: cli zb and zbx command-line behavior area: install install, uninstall, upgrade, outdated, and migration flows priority: medium normal priority type: bug something is broken or behaving incorrectly

Projects

None yet

Development

Successfully merging this pull request may close these issues.

zb bundle install stops at the first post-install failure

2 participants