brew/Library/Homebrew/extend/os/linux/simulate_system.rb

29 lines
604 B
Ruby
Raw Normal View History

# typed: strict
2022-11-21 21:04:22 -08:00
# frozen_string_literal: true
module OS
module Linux
module SimulateSystem
2022-11-21 21:04:22 -08:00
sig { returns(T.nilable(Symbol)) }
def os
@os ||= T.let(nil, T.nilable(Symbol))
2022-11-21 21:04:22 -08:00
return :macos if @os.blank? && Homebrew::EnvConfig.simulate_macos_on_linux?
@os
end
sig { returns(T::Boolean) }
def simulating_or_running_on_linux?
os.blank? || os == :linux
end
sig { returns(Symbol) }
def current_os
os || :linux
end
end
end
end
Homebrew::SimulateSystem.singleton_class.prepend(OS::Linux::SimulateSystem)