AbstractUninstall: coerce which argument to String

`Cask::Artifact::AbstractUninstall.uninstall_script` contains a
`which` call that uses a `Pathname` argument instead of a `String` and
this leads to a type error (`Parameter 'cmd': Expected type String,
got type Pathname with value...`). This resolves the error by calling
`#to_s` on the `executable_path` argument.
This commit is contained in:
Sam Ford 2025-08-28 11:21:57 -04:00
parent f6ce120b40
commit ba0bc88b3d
No known key found for this signature in database
GPG Key ID: 7AF5CBEE1DD6F76D

View File

@ -376,7 +376,7 @@ module Cask
executable_path = staged_path_join_executable(executable) executable_path = staged_path_join_executable(executable)
if (executable_path.absolute? && !executable_path.exist?) || if (executable_path.absolute? && !executable_path.exist?) ||
(!executable_path.absolute? && (which executable_path).nil?) (!executable_path.absolute? && which(executable_path.to_s).nil?)
message = "uninstall script #{executable} does not exist" message = "uninstall script #{executable} does not exist"
raise CaskError, "#{message}." unless force raise CaskError, "#{message}." unless force