From 73cb4b5b42f92471776105e07fd53aa969a7c057 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lukas=20L=C3=B6sche?= Date: Thu, 18 Oct 2018 15:13:18 +0200 Subject: [PATCH] Fix WSL detection for customized roots --- lib/vagrant/util/platform.rb | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/lib/vagrant/util/platform.rb b/lib/vagrant/util/platform.rb index b695546fe..8aee0d4e5 100644 --- a/lib/vagrant/util/platform.rb +++ b/lib/vagrant/util/platform.rb @@ -35,11 +35,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