Merge pull request #18333 from Homebrew/ld-so-diagnostics-typeerror

This commit is contained in:
Carlo Cabrera 2024-09-17 12:09:09 +08:00 committed by GitHub
commit 04a2c994e5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -7,13 +7,18 @@ module OS
module Ld
sig { returns(String) }
def self.brewed_ld_so_diagnostics
@brewed_ld_so_diagnostics ||= T.let({}, T.nilable(T::Hash[Pathname, String]))
brewed_ld_so = HOMEBREW_PREFIX/"lib/ld.so"
return "" unless brewed_ld_so.exist?
ld_so_output = Utils.popen_read(brewed_ld_so, "--list-diagnostics")
return "" unless $CHILD_STATUS.success?
brewed_ld_so_target = brewed_ld_so.readlink
@brewed_ld_so_diagnostics[brewed_ld_so_target] ||= begin
ld_so_output = Utils.popen_read(brewed_ld_so, "--list-diagnostics")
ld_so_output if $CHILD_STATUS.success?
end
ld_so_output
@brewed_ld_so_diagnostics[brewed_ld_so_target].to_s
end
sig { returns(String) }