From 323663c4fb802a97d1f95b61823db70feab49845 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Wed, 4 Jan 2012 21:46:46 -0800 Subject: [PATCH] Handle MacPorts strange VirtualBox version formatting [GH-619] --- lib/vagrant/driver/virtualbox.rb | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/vagrant/driver/virtualbox.rb b/lib/vagrant/driver/virtualbox.rb index 9385f3549..b658edd16 100644 --- a/lib/vagrant/driver/virtualbox.rb +++ b/lib/vagrant/driver/virtualbox.rb @@ -444,7 +444,14 @@ module Vagrant # # @return [String] def read_version - execute("--version").split("r")[0] + # The version string is usually in one of the following formats: + # + # * 4.1.8r1234 + # * 4.1.8r1234_OSE + # * 4.1.8_MacPortsr1234 + # + # Below accounts for all of these: + execute("--version").split("_")[0].split("r")[0] end # Execute the given subcommand for VBoxManage and return the output.