Don't error if machine shuts down really quickly on graceful [GH-1505]

This commit is contained in:
Mitchell Hashimoto 2013-03-28 15:52:00 -07:00
parent ed038c8c64
commit 665450614a
4 changed files with 20 additions and 3 deletions

View File

@ -7,6 +7,8 @@ IMPROVEMENTS:
BUG FIXES:
- Proper error message if invalid provisioner is used. [GH-1515]
- Don't error on graceful halt if machine just shut down very
quickly. [GH-1505]
## 1.1.4 (March 25, 2013)

View File

@ -12,7 +12,12 @@ module VagrantPlugins
end
def halt
vm.communicate.sudo("shutdown -p now")
begin
vm.communicate.sudo("shutdown -p now")
rescue IOError
# Do nothing because SSH connection closed and it probably
# means the VM just shut down really fast.
end
end
# TODO: vboxsf is currently unsupported in FreeBSD, if you are able to

View File

@ -39,7 +39,12 @@ module VagrantPlugins
end
def halt
@vm.communicate.sudo("shutdown -h now")
begin
@vm.communicate.sudo("shutdown -h now")
rescue IOError
# Do nothing, because it probably means the machine shut down
# and SSH connection was lost.
end
end
def mount_shared_folder(name, guestpath, options)

View File

@ -45,7 +45,12 @@ module VagrantPlugins
#
# does not exist in /etc/user_attr. TODO
def halt
vm.communicate.execute("#{vm.config.solaris.suexec_cmd} /usr/sbin/poweroff")
begin
vm.communicate.execute("#{vm.config.solaris.suexec_cmd} /usr/sbin/poweroff")
rescue IOError
# Ignore, this probably means connection closed because it
# shut down.
end
end
def mount_shared_folder(name, guestpath, options)