Merge pull request #10313 from lloesche/lloesche/fix_wsl_detection
Fix WSL detection for customized roots
This commit is contained in:
commit
43f7a16baa
|
@ -43,11 +43,10 @@ module Vagrant
|
|||
if !defined?(@_wsl)
|
||||
@_wsl = false
|
||||
SilenceWarnings.silence! do
|
||||
# Use PATH values to check for `/mnt/c` path indicative of WSL
|
||||
if ENV.fetch("PATH", "").downcase.include?("/mnt/c")
|
||||
# Validate WSL via uname output
|
||||
uname = Subprocess.execute("uname", "-r")
|
||||
if uname.exit_code == 0 && uname.stdout.downcase.include?("microsoft")
|
||||
# Find 'microsoft' in /proc/version indicative of WSL
|
||||
if File.file?('/proc/version')
|
||||
osversion = File.open('/proc/version', &:gets)
|
||||
if osversion.downcase.include?("microsoft")
|
||||
@_wsl = true
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue