coily upgrade --dry exits non-zero when an upgrade is available #86
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Symptom
coily upgrade --dryexits non-zero (3, wrapping brew's exit 1) whenever an upgrade is available, which is the success case for a dry-run.Repro
On a host where the installed coily is behind the formula:
Cause
runUpgradeincmd/coily/upgrade.goshells out tobrew outdated <formula>for the dry path.brew outdatedexits 1 when the formula is outdated, 0 when current. coily propagates the exit code verbatim, so "there is an upgrade waiting" is reported as a verb failure.Expected
coily upgrade --dryexits 0 when it successfully prints the version diff (whether or not anything is outdated), and only exits non-zero when brew itself failed to produce a diff (tap unreachable, formula unknown, etc.). The diff itself is the deliverable; whether the version moved is information, not a failure.Fix sketch
In
runUpgrade, whendryis set, treatbrew outdated's exit 1 as a normal outcome. Either swallow exit 1 specifically, or usebrew info --json/ a comparison path that doesn't encode "outdated" as an error. Keep other brew failure modes as errors.Context
Came up on Kai's Mac during a tap-remote swap from GitHub to Forgejo. Hit immediately after the swap when checking the upgrade was wired up correctly — the diff was correct, the exit code lied about it.