1 second sleep after the halt on `down` to allow VirtualBox to clean itself up

This commit is contained in:
Mitchell Hashimoto 2010-05-30 17:56:20 -07:00
parent 85f4fb230d
commit 6fc2f4661a
3 changed files with 4 additions and 11 deletions

View File

@ -10,10 +10,10 @@ module Vagrant
end end
def after_halt def after_halt
# This sleep is necessary to wait for the GUI to clean itself up. # This sleep is necessary to wait for the VM to clean itself up.
# There appears to be nothing in the API that does this "wait" # There appears to be nothing in the API that does this "wait"
# for us. # for us.
Kernel.sleep(1) if @runner.env.config.vm.boot_mode == "gui" Kernel.sleep(1)
end end
end end
end end

View File

@ -31,16 +31,9 @@ class DownActionTest < Test::Unit::TestCase
end end
context "after halting" do context "after halting" do
should "sleep if boot mode is GUI" do should "sleep" do
@runner.env.config.vm.boot_mode = "gui"
Kernel.expects(:sleep).once Kernel.expects(:sleep).once
@action.after_halt @action.after_halt
end end
should "not sleep if boot mode is anything else" do
@runner.env.config.vm.boot_mode = "vrdp"
Kernel.expects(:sleep).never
@action.after_halt
end
end end
end end

View File

@ -9,7 +9,7 @@ Gem::Specification.new do |s|
s.required_rubygems_version = Gem::Requirement.new("> 1.3.1") if s.respond_to? :required_rubygems_version= s.required_rubygems_version = Gem::Requirement.new("> 1.3.1") if s.respond_to? :required_rubygems_version=
s.authors = ["Mitchell Hashimoto", "John Bender"] s.authors = ["Mitchell Hashimoto", "John Bender"]
s.date = %q{2010-05-29} s.date = %q{2010-05-30}
s.default_executable = %q{vagrant} s.default_executable = %q{vagrant}
s.description = %q{Vagrant is a tool for building and distributing virtualized development environments.} s.description = %q{Vagrant is a tool for building and distributing virtualized development environments.}
s.email = ["mitchell.hashimoto@gmail.com", "john.m.bender@gmail.com"] s.email = ["mitchell.hashimoto@gmail.com", "john.m.bender@gmail.com"]