Skip to content

Conversation

@Bo98
Copy link
Member

@Bo98 Bo98 commented Jan 7, 2026

#21310 presented a good case for returning an exit code on brew tap-info however this shouldn't apply to --json for multiple reasons:

  • Unlike regular brew tap-info, brew tap-info --json is designed to work on uninstalled core taps (i.e. from the API).
  • brew tap-info --json is able to provide install locations even when taps aren't installed.
  • There's already a dedicated entry for installed in the JSON
  • Being able to differentiate between parseable JSON output and non-parseable output (e.g. Ruby error) is important.

This fixes regressions seen downstream (public example: rcmdnk/homebrew-file#373).

The case originally presented in #21301 is still retained since that talked about the non-JSON case.

Copilot AI review requested due to automatic review settings January 7, 2026 06:05
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR reverts exit code behavior changes for the --json mode of brew tap-info, addressing regressions in downstream tools. The JSON mode now always returns a success exit code (0) regardless of tap installation status, while the non-JSON mode continues to return a failure exit code (1) for uninstalled taps.

  • Removes Homebrew.failed = true check from print_tap_json method
  • Simplifies the JSON generation code from explicit iteration to a concise map(&:to_hash) call
  • Maintains existing behavior for non-JSON mode where uninstalled taps trigger failure exit codes

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Member

@MikeMcQuaid MikeMcQuaid left a comment

Choose a reason for hiding this comment

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

Makes sense for JSON case, agreed, thanks!

@MikeMcQuaid MikeMcQuaid added this pull request to the merge queue Jan 7, 2026
Merged via the queue into main with commit 7742f77 Jan 7, 2026
43 checks passed
@MikeMcQuaid MikeMcQuaid deleted the tap-info-regression branch January 7, 2026 08:08
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.

4 participants