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