Merge pull request #9674 from chrisroberts/f-wsl-version-check

Check Windows installed Vagrant version using --version
This commit is contained in:
Chris Roberts 2018-04-10 14:47:06 -07:00 committed by GitHub
commit b2db1adb7c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 4 deletions

View File

@ -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: (?<version>[\w.-]+)/)
windows_version = result.stdout.match(/Vagrant (?<version>[\w.-]+)/)
if windows_version
windows_version = windows_version[:version].strip
valid = windows_version == Vagrant::VERSION

View File

@ -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