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

View File

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