From 612fec47f38a6b1afedc6e51177ff3044744833a Mon Sep 17 00:00:00 2001 From: Sam Ford <1584702+samford@users.noreply.github.com> Date: Thu, 3 Apr 2025 17:35:26 -0400 Subject: [PATCH] bump-cask-pr: rescue CaskUnreadableError The `replace_version_and_checksum` method handles a `CaskInvalidError` when loading a cask (handling casks that aren't valid on Linux) but we can sometimes still encounter an error when bumping a cask with on_system blocks. For example, bumping `displaylink` will produce a `Cask 'displaylink' is unreadable: undefined method 'csv' for nil` error when `SimulateSystem` runs as Linux, as the cask interpolates `version.csv.first` in a `license` string but `version` isn't set on Linux. This adds `Cask::CaskUnreadableError` to the `rescue` arguments, which accounts for this particular situation (allowing `displaylink` to be bumped like before). --- Library/Homebrew/dev-cmd/bump-cask-pr.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Library/Homebrew/dev-cmd/bump-cask-pr.rb b/Library/Homebrew/dev-cmd/bump-cask-pr.rb index b7b561bffe..ab35767a4b 100644 --- a/Library/Homebrew/dev-cmd/bump-cask-pr.rb +++ b/Library/Homebrew/dev-cmd/bump-cask-pr.rb @@ -220,7 +220,7 @@ module Homebrew # Handle the cask being invalid for specific os/arch combinations old_cask = begin Cask::CaskLoader.load(cask.sourcefile_path) - rescue Cask::CaskInvalidError + rescue Cask::CaskInvalidError, Cask::CaskUnreadableError raise unless cask.on_system_blocks_exist? end next if old_cask.nil?