Add fix for race condition in windows cache extraction

Ran into the same issue described in #2574

There appears to be a timing issue due to the defered Close() on the cache zip.
I've tested with this change in our environment and it we no longer get the
`FATAL: rename...` error.
parent 186fd9e2
......@@ -42,7 +42,6 @@ func (c *CacheExtractorCommand) download() (bool, error) {
if err != nil {
return false, err
}
defer file.Close()
defer os.Remove(file.Name())
resp, err := c.getClient().Get(c.URL)
......@@ -73,6 +72,7 @@ func (c *CacheExtractorCommand) download() (bool, error) {
}
os.Chtimes(file.Name(), time.Now(), date)
file.Close()
err = os.Rename(file.Name(), c.File)
if err != nil {
return false, err
......
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