Rename Volumes.which to avoid incompatible override

This commit is contained in:
Douglas Eichelberger 2025-08-23 19:05:44 -07:00
parent ceb2291be1
commit 2dc4c7a4d2
No known key found for this signature in database
GPG Key ID: F90193CBD547EB81
2 changed files with 9 additions and 8 deletions

View File

@ -10,11 +10,8 @@ module OS
@volumes = T.let(get_mounts, T::Array[String])
end
# This is a pre-existing violation that should be refactored
# rubocop:todo Sorbet/AllowIncompatibleOverride
sig { override(allow_incompatible: true).params(path: T.nilable(Pathname)).returns(Integer) }
# rubocop:enable Sorbet/AllowIncompatibleOverride
def which(path)
sig { params(path: T.nilable(Pathname)).returns(Integer) }
def index_of(path)
vols = get_mounts path
# no volume found
@ -429,13 +426,13 @@ module OS
# Find the volumes for the TMP folder & HOMEBREW_CELLAR
real_cellar = HOMEBREW_CELLAR.realpath
where_cellar = volumes.which real_cellar
where_cellar = volumes.index_of real_cellar
begin
tmp = Pathname.new(Dir.mktmpdir("doctor", HOMEBREW_TEMP))
begin
real_tmp = tmp.realpath.parent
where_tmp = volumes.which real_tmp
where_tmp = volumes.index_of real_tmp
ensure
Dir.delete tmp.to_s
end

View File

@ -40,7 +40,11 @@ module Homebrew
yield if block_given?
args.map!(&:to_s)
begin
if argv0
exec(cmd, argv0, *args, **options)
else
exec(cmd, *args, **options)
end
rescue
nil
end