Skip to content

Commit 612fec4

Browse files
committed
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).
1 parent 38410f5 commit 612fec4

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Library/Homebrew/dev-cmd/bump-cask-pr.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ def replace_version_and_checksum(cask, new_hash, new_version, replacement_pairs)
220220
# Handle the cask being invalid for specific os/arch combinations
221221
old_cask = begin
222222
Cask::CaskLoader.load(cask.sourcefile_path)
223-
rescue Cask::CaskInvalidError
223+
rescue Cask::CaskInvalidError, Cask::CaskUnreadableError
224224
raise unless cask.on_system_blocks_exist?
225225
end
226226
next if old_cask.nil?

0 commit comments

Comments
 (0)