From 42f157143f65da7acfa6e32fa31e640012caa058 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Tue, 20 Nov 2012 11:00:19 -0800 Subject: [PATCH] Forward-port fix for OS X and VirtualBox bug from 1-0-stable --- plugins/providers/virtualbox/driver/base.rb | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/plugins/providers/virtualbox/driver/base.rb b/plugins/providers/virtualbox/driver/base.rb index 1b503e95034..165c0e15a56 100644 --- a/plugins/providers/virtualbox/driver/base.rb +++ b/plugins/providers/virtualbox/driver/base.rb @@ -317,9 +317,24 @@ def raw(*command, &block) # Append in the options for subprocess command << { :notify => [:stdout, :stderr] } + # The following is a workaround for a combined VirtualBox and + # Mac OS X 10.8 bug: + # + # Remove the DYLD_LIBRARY_PATH environmental variable on Mac. This + # is to fix a bug in Mac OS X 10.8 where a warning is printed to the + # console if this is set when executing certain programs, which + # can cause some VBoxManage commands to break because they work + # by just reading stdout and don't expect the OS to just inject + # garbage into it. + old_dyld_lib_path = ENV.delete("DYLD_LIBRARY_PATH") + Vagrant::Util::Busy.busy(int_callback) do Vagrant::Util::Subprocess.execute(@vboxmanage_path, *command, &block) end + ensure + # Reset the library path if it was set before. See above comments + # for more information on why this was unset in the first place. + ENV["DYLD_LIBRARY_PATH"] = old_dyld_lib_path if old_dyld_lib_path end end end