Skip to content

Commit f275198

Browse files
committed
* test dest
1 parent e68a942 commit f275198

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

remote_fetch.go

Lines changed: 22 additions & 0 deletions
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,28 @@ func decompressResponse(bodyBytes []byte, contentLength int64, cacheLocator Cach
111112
return errorExtractingPostgres(err)
112113
}
113114

115+
tmp2, err := os.MkdirTemp("", "embedded_postgres")
116+
if err != nil {
117+
return errorExtractingPostgres(err)
118+
}
119+
120+
tm, err := os.CreateTemp("", "test")
121+
if err != nil {
122+
return errorExtractingPostgres(err)
123+
}
124+
125+
if err := atomic.Rename(tm.Name(), path.Join(tmp2, "temp")); err != nil {
126+
fmt.Println("=>=>=>=>=>", "TEST FAIL")
127+
if strings.Contains(err.Error(), "The process cannot access the file because it is being used by another process") {
128+
fmt.Printf("WARN: %v\n", err)
129+
return nil
130+
}
131+
132+
return errorExtractingPostgres(err)
133+
}
134+
114135
if err := atomic.Rename(tmp.Name(), cacheLocation); err != nil {
136+
fmt.Println("=>=>=>=>=>", "2")
115137
if strings.Contains(err.Error(), "The process cannot access the file because it is being used by another process") {
116138
fmt.Printf("WARN: %v\n", err)
117139
return nil

0 commit comments

Comments
 (0)