Merge pull request #9674 from chrisroberts/f-wsl-version-check
Check Windows installed Vagrant version using --version
This commit is contained in:
commit
b2db1adb7c
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue