diff --git a/lib/vagrant/util/platform.rb b/lib/vagrant/util/platform.rb index bcf66c751..5bc0a603b 100644 --- a/lib/vagrant/util/platform.rb +++ b/lib/vagrant/util/platform.rb @@ -561,9 +561,9 @@ module Vagrant def wsl_validate_matching_vagrant_versions! valid = false if Util::Which.which("vagrant.exe") - result = Util::Subprocess.execute("vagrant.exe", "version") + result = Util::Subprocess.execute("vagrant.exe", "--version") if result.exit_code == 0 - windows_version = result.stdout.match(/Installed Version: (?[\w.-]+)/) + windows_version = result.stdout.match(/Vagrant (?[\w.-]+)/) if windows_version windows_version = windows_version[:version].strip valid = windows_version == Vagrant::VERSION diff --git a/test/unit/vagrant/util/platform_test.rb b/test/unit/vagrant/util/platform_test.rb index 80100e349..f43afd1d8 100644 --- a/test/unit/vagrant/util/platform_test.rb +++ b/test/unit/vagrant/util/platform_test.rb @@ -185,8 +185,8 @@ describe Vagrant::Util::Platform do before do allow(Vagrant::Util::Which).to receive(:which).and_return(true) - allow(Vagrant::Util::Subprocess).to receive(:execute).with("vagrant.exe", "version"). - and_return(double(exit_code: 0, stdout: "Installed Version: #{exe_version}")) + allow(Vagrant::Util::Subprocess).to receive(:execute).with("vagrant.exe", "--version"). + and_return(double(exit_code: 0, stdout: "Vagrant #{exe_version}")) end it "should not raise an error" do