From 5de3a948fa55224d33f5aa81aa5fa96eb0dd90ef Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Wed, 31 Jul 2013 15:35:47 -0700 Subject: [PATCH] builder/vmware: sleep before cleaning files on Windows --- builder/vmware/step_shutdown.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/builder/vmware/step_shutdown.go b/builder/vmware/step_shutdown.go index 97b8efbee..4355a047f 100644 --- a/builder/vmware/step_shutdown.go +++ b/builder/vmware/step_shutdown.go @@ -8,6 +8,7 @@ import ( "github.com/mitchellh/packer/packer" "log" "path/filepath" + "runtime" "strings" "time" ) @@ -120,6 +121,13 @@ LockWaitLoop: } } + if runtime.GOOS == "windows" { + // Windows takes a while to yield control of the files when the + // process is exiting. We just sleep here. In the future, it'd be + // nice to find a better solution to this. + time.Sleep(5 * time.Second) + } + log.Println("VM shut down.") return multistep.ActionContinue }