Skip to content

Commit c7db0ef

Browse files
committed
* test dest
1 parent e68a942 commit c7db0ef

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

remote_fetch.go

+18-1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import (
1111
"log"
1212
"net/http"
1313
"os"
14+
"path"
1415
"path/filepath"
1516
"strings"
1617

@@ -111,7 +112,23 @@ func decompressResponse(bodyBytes []byte, contentLength int64, cacheLocator Cach
111112
return errorExtractingPostgres(err)
112113
}
113114

114-
if err := atomic.Rename(tmp.Name(), cacheLocation); err != nil {
115+
tmp2, err := os.MkdirTemp("", "embedded_postgres")
116+
if err != nil {
117+
return errorExtractingPostgres(err)
118+
}
119+
120+
if err := atomic.Rename(tmp.Name(), path.Join(tmp2, "temp")); err != nil {
121+
fmt.Println("=>=>=>=>=>", "1")
122+
if strings.Contains(err.Error(), "The process cannot access the file because it is being used by another process") {
123+
fmt.Printf("WARN: %v\n", err)
124+
return nil
125+
}
126+
127+
return errorExtractingPostgres(err)
128+
}
129+
130+
if err := atomic.Rename(path.Join(tmp2, "temp"), cacheLocation); err != nil {
131+
fmt.Println("=>=>=>=>=>", "2")
115132
if strings.Contains(err.Error(), "The process cannot access the file because it is being used by another process") {
116133
fmt.Printf("WARN: %v\n", err)
117134
return nil

0 commit comments

Comments
 (0)