os/linux.rb: wsl_version: apply suggestions from code review
Co-authored-by: Mike McQuaid <mike@mikemcquaid.com>
This commit is contained in:
parent
c9b289fc3d
commit
2b008ae7fd
@ -35,16 +35,20 @@ module OS
|
|||||||
|
|
||||||
sig { returns(Version) }
|
sig { returns(Version) }
|
||||||
def wsl_version
|
def wsl_version
|
||||||
Version::NULL unless wsl?
|
return Version::NULL unless wsl?
|
||||||
kernel = OS.kernel_version.to_s
|
|
||||||
return Version.new("2 (Microsoft Store)") if Version.new(T.must(kernel[/^([0-9.]*)-.*/,
|
|
||||||
1])) > Version.new("5.15")
|
|
||||||
return Version.new("2") if kernel.include?("-microsoft")
|
|
||||||
return Version.new("1") if kernel.include?("-Microsoft")
|
|
||||||
|
|
||||||
|
kernel = OS.kernel_version.to_s
|
||||||
|
if Version.new(T.must(kernel[/^([0-9.]*)-.*/, 1])) > Version.new("5.15")
|
||||||
|
Version.new("2 (Microsoft Store)")
|
||||||
|
elsif kernel.include?("-microsoft")
|
||||||
|
Version.new("2")
|
||||||
|
elsif kernel.include?("-Microsoft")
|
||||||
|
Version.new("1")
|
||||||
|
else
|
||||||
Version::NULL
|
Version::NULL
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
# rubocop:disable Style/Documentation
|
# rubocop:disable Style/Documentation
|
||||||
module Mac
|
module Mac
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user