Merge pull request #14880 from dduugg/fix--env

Fix type error in brew --env
This commit is contained in:
Mike McQuaid 2023-03-06 12:33:11 +00:00 committed by GitHub
commit 5689065c9e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 7 additions and 4 deletions

View File

@ -296,7 +296,9 @@ module Homebrew
[remaining, non_options] [remaining, non_options]
end end
sig { params(argv: T::Array[String], ignore_invalid_options: T::Boolean).returns(Args) } # @return [Args] The actual return type is `Args`, but since `Args` uses `method_missing` to handle options, the
# `sig` annotates this as returning `T.untyped` to avoid spurious type errors.
sig { params(argv: T::Array[String], ignore_invalid_options: T::Boolean).returns(T.untyped) }
def parse(argv = ARGV.freeze, ignore_invalid_options: false) def parse(argv = ARGV.freeze, ignore_invalid_options: false)
raise "Arguments were already parsed!" if @args_parsed raise "Arguments were already parsed!" if @args_parsed

View File

@ -1,4 +1,4 @@
# typed: false # typed: strict
# frozen_string_literal: true # frozen_string_literal: true
require "extend/ENV" require "extend/ENV"
@ -49,7 +49,7 @@ module Homebrew
end end
if shell.nil? if shell.nil?
BuildEnvironment.dump ENV BuildEnvironment.dump ENV.to_h
else else
BuildEnvironment.keys(ENV.to_h).each do |key| BuildEnvironment.keys(ENV.to_h).each do |key|
puts Utils::Shell.export_value(key, ENV.fetch(key), shell) puts Utils::Shell.export_value(key, ENV.fetch(key), shell)

View File

@ -36,6 +36,7 @@ end
module EnvActivation module EnvActivation
include EnvMethods include EnvMethods
include Superenv
end end
class Sorbet class Sorbet

View File

@ -19,7 +19,7 @@ begin
trap("INT", old_trap) trap("INT", old_trap)
formula = T.must(args.named.to_resolved_formulae.first) formula = args.named.to_resolved_formulae.first
formula.extend(Debrew::Formula) if args.debug? formula.extend(Debrew::Formula) if args.debug?
formula.run_post_install formula.run_post_install
rescue Exception => e # rubocop:disable Lint/RescueException rescue Exception => e # rubocop:disable Lint/RescueException