Fix tests

This commit is contained in:
Douglas Eichelberger 2023-03-30 15:56:18 -07:00
parent a4091b4260
commit 80091b8a58
5 changed files with 18 additions and 19 deletions

View File

@ -199,7 +199,7 @@ module Homebrew
sig { params(repo_path: Pathname, person: String, trailer: String, args: Homebrew::CLI::Args).returns(Integer) }
def git_log_trailers_cmd(repo_path, person, trailer, args)
cmd = ["git", "-C", repo_path.to_s, "log", "--oneline"]
cmd = ["git", "-C", repo_path, "log", "--oneline"]
cmd << "--format='%(trailers:key=#{trailer}:)'"
cmd << "--before=#{args.to}" if args.to
cmd << "--after=#{args.from}" if args.from

View File

@ -117,6 +117,6 @@ module GitRepositoryExtension
raise "Git is unavailable"
end
T.unsafe(Utils).popen_read(Utils::Git.git, *args, safe: safe, chdir: self, err: err).chomp.presence
Utils.popen_read(Utils::Git.git, *args, safe: safe, chdir: self, err: err).chomp.presence
end
end

View File

@ -131,7 +131,7 @@ module ELFShim
return if needed.empty?
ldd = DevelopmentTools.locate "ldd"
ldd_output = Utils.popen_read(T.must(ldd).to_s, path.expand_path.to_s).split("\n")
ldd_output = Utils.popen_read(T.must(ldd), path.expand_path.to_s).split("\n")
return unless $CHILD_STATUS.success?
ldd_paths = ldd_output.map do |line|

View File

@ -161,8 +161,7 @@ module OS
# Xcode.prefix is pretty smart, so let's look inside to find the sdk
sdk_prefix = "#{Xcode.prefix}/Platforms/MacOSX.platform/Developer/SDKs"
# Finally query Xcode itself (this is slow, so check it last)
sdk_platform_path = Utils.popen_read(DevelopmentTools.locate("xcrun").to_s,
"--show-sdk-platform-path").chomp
sdk_platform_path = Utils.popen_read(T.must(DevelopmentTools.locate("xcrun")), "--show-sdk-platform-path").chomp
sdk_prefix = File.join(sdk_platform_path, "Developer", "SDKs") unless File.directory? sdk_prefix
sdk_prefix

View File

@ -9,11 +9,11 @@ module Utils
sig {
params(
args: T.any(String, T::Hash[String, String]),
args: T.any(Pathname, String, T::Hash[String, String]),
safe: T::Boolean,
options: Symbol,
options: T.untyped,
block: T.nilable(T.proc.params(io: IO).void),
).returns(String)
).returns(T.nilable(String))
}
def self.popen_read(*args, safe: false, **options, &block)
output = popen(args, "rb", options, &block)
@ -24,10 +24,10 @@ module Utils
sig {
params(
args: T.any(String, T::Hash[String, String]),
options: Symbol,
args: T.any(Pathname, String, T::Hash[String, String]),
options: T.untyped,
block: T.nilable(T.proc.params(io: IO).void),
).returns(String)
).returns(T.nilable(String))
}
def self.safe_popen_read(*args, **options, &block)
popen_read(*args, safe: true, **options, &block)
@ -35,11 +35,11 @@ module Utils
sig {
params(
args: T.any(String, T::Hash[String, String]),
args: T.any(Pathname, String, T::Hash[String, String]),
safe: T::Boolean,
options: Symbol,
options: T.untyped,
_block: T.proc.params(io: IO).void,
).returns(String)
).returns(T.nilable(String))
}
def self.popen_write(*args, safe: false, **options, &_block)
output = ""
@ -66,10 +66,10 @@ module Utils
sig {
params(
args: T.any(String, T::Hash[String, String]),
options: Symbol,
args: T.any(Pathname, String, T::Hash[String, String]),
options: T.untyped,
block: T.nilable(T.proc.params(io: IO).void),
).returns(String)
).returns(T.nilable(String))
}
def self.safe_popen_write(*args, **options, &block)
popen_write(*args, safe: true, **options, &block)
@ -77,11 +77,11 @@ module Utils
sig {
params(
args: T::Array[T.any(String, T::Hash[String, String])],
args: T::Array[T.any(Pathname, String, T::Hash[String, String])],
mode: String,
options: T::Hash[Symbol, T.untyped],
block: T.nilable(T.proc.params(io: IO).void),
).returns(String)
).returns(T.nilable(String))
}
def self.popen(args, mode, options = {}, &block)
IO.popen("-", mode) do |pipe|