From 6d7a3d9b649e1ad778230471705da66c3fa5b19b Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Fri, 27 Jan 2012 12:40:42 -0800 Subject: [PATCH] More accurate VBoxManage error detection. --- CHANGELOG.md | 1 + lib/vagrant/driver/virtualbox_base.rb | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 47fb34b59..2424e3c6b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ - Fix issue where VM import sometimes made strange VirtualBox folder layouts. [GH-669] - Call proper `id` command on Solaris. [GH-679] + - More accurate VBoxManage error detection. ## 0.9.3 (January 24, 2012) diff --git a/lib/vagrant/driver/virtualbox_base.rb b/lib/vagrant/driver/virtualbox_base.rb index ed1227e2e..2826362ae 100644 --- a/lib/vagrant/driver/virtualbox_base.rb +++ b/lib/vagrant/driver/virtualbox_base.rb @@ -260,6 +260,14 @@ module Vagrant else raise Errors::VBoxManageError, :command => command.inspect end + else + # Sometimes, VBoxManage fails but doesn't actual return a non-zero + # exit code. For this we inspect the output and determine if an error + # occurred. + if r.stderr =~ /VBoxManage: error:/ + @logger.info("VBoxManage error text found, assuming error.") + raise Errors::VBoxManageError, :command => command.inspect + end end # Return the output, making sure to replace any Windows-style