diff --git a/CHANGELOG.md b/CHANGELOG.md index 87b373f90..512f4a786 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,8 @@ - `vagrant destroy` now asks for confirmation by default. This can be overridden with the `--force` flag. [GH-699] - Fix issue with Puppet config inheritance. [GH-722] + - Fix issue where starting a VM on some systems was incorrectly treated + as failing. [GH-720] ## 0.9.6 (February 7, 2012) diff --git a/lib/vagrant/driver/virtualbox_4_0.rb b/lib/vagrant/driver/virtualbox_4_0.rb index 1a16d44e4..8c01fd74f 100644 --- a/lib/vagrant/driver/virtualbox_4_0.rb +++ b/lib/vagrant/driver/virtualbox_4_0.rb @@ -417,7 +417,17 @@ module Vagrant end def start(mode) - execute("startvm", @uuid, "--type", mode.to_s) + command = ["startvm", @uuid, "--type", mode.to_s] + r = raw(*command) + + if r.exit_code == 0 || r.stdout =~ /VM ".+?" has been successfully started/ + # Some systems return an exit code 1 for some reason. For that + # we depend on the output. + return true + end + + # If we reached this point then it didn't work out. + raise Errors::VBoxManageError, :command => command.inspect end def suspend diff --git a/lib/vagrant/driver/virtualbox_4_1.rb b/lib/vagrant/driver/virtualbox_4_1.rb index 8fb2ee367..436121b12 100644 --- a/lib/vagrant/driver/virtualbox_4_1.rb +++ b/lib/vagrant/driver/virtualbox_4_1.rb @@ -417,7 +417,17 @@ module Vagrant end def start(mode) - execute("startvm", @uuid, "--type", mode.to_s) + command = ["startvm", @uuid, "--type", mode.to_s] + r = raw(*command) + + if r.exit_code == 0 || r.stdout =~ /VM ".+?" has been successfully started/ + # Some systems return an exit code 1 for some reason. For that + # we depend on the output. + return true + end + + # If we reached this point then it didn't work out. + raise Errors::VBoxManageError, :command => command.inspect end def suspend