Commit 55802746 authored by Mitchell Hashimoto's avatar Mitchell Hashimoto

builder/virtualbox,vmware: retry removing output dir if fails

parent 8ac03e48
......@@ -17,6 +17,8 @@ BUG FIXES:
* builder/virtualbox,vmware: relative paths work properly as URL
configurations. [GH-215]
* builder/virtualbox,vmware: fix race condition in deleting the output
directory on Windows by retrying.
## 0.2.1 (July 26, 2013)
......
......@@ -3,7 +3,9 @@ package virtualbox
import (
"github.com/mitchellh/multistep"
"github.com/mitchellh/packer/packer"
"log"
"os"
"time"
)
type stepPrepareOutputDir struct{}
......@@ -34,6 +36,14 @@ func (stepPrepareOutputDir) Cleanup(state map[string]interface{}) {
ui := state["ui"].(packer.Ui)
ui.Say("Deleting output directory...")
os.RemoveAll(config.OutputDir)
for i := 0; i < 5; i++ {
err := os.RemoveAll(config.OutputDir)
if err == nil {
break
}
log.Printf("Error removing output dir: %s", err)
time.Sleep(2 * time.Second)
}
}
}
......@@ -3,7 +3,9 @@ package vmware
import (
"github.com/mitchellh/multistep"
"github.com/mitchellh/packer/packer"
"log"
"os"
"time"
)
type stepPrepareOutputDir struct{}
......@@ -34,6 +36,15 @@ func (stepPrepareOutputDir) Cleanup(state map[string]interface{}) {
ui := state["ui"].(packer.Ui)
ui.Say("Deleting output directory...")
os.RemoveAll(config.OutputDir)
for i := 0; i < 5; i++ {
err := os.RemoveAll(config.OutputDir)
if err == nil {
break
}
log.Printf("Error removing output dir: %s", err)
time.Sleep(2 * time.Second)
}
}
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment