os: add uname method
This will allow us to replace code like
os = if OS.mac?
"Darwin"
else
"Linux"
end
with a call to `OS.uname`. Doing
rg '= (if )?OS\.(mac|linux)\?'
returns about 70 matches, so there are probably at least a handful of
formulae that could be simplified by this.
This commit is contained in:
parent
f50b87031e
commit
c90e63b299
@ -35,6 +35,14 @@ module OS
|
|||||||
@kernel_version ||= Version.new(Utils.safe_popen_read("uname", "-r").chomp)
|
@kernel_version ||= Version.new(Utils.safe_popen_read("uname", "-r").chomp)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Get the kernel name.
|
||||||
|
#
|
||||||
|
# @api public
|
||||||
|
sig { returns(String) }
|
||||||
|
def self.uname
|
||||||
|
@uname ||= Utils.safe_popen_read("uname").chomp
|
||||||
|
end
|
||||||
|
|
||||||
::OS_VERSION = ENV["HOMEBREW_OS_VERSION"]
|
::OS_VERSION = ENV["HOMEBREW_OS_VERSION"]
|
||||||
|
|
||||||
CI_GLIBC_VERSION = "2.23"
|
CI_GLIBC_VERSION = "2.23"
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user