aboutsummaryrefslogtreecommitdiff
path: root/repo.go
diff options
context:
space:
mode:
authorn-peugnet <n.peugnet@free.fr>2021-09-13 13:13:12 +0200
committerNicolas Peugnet <n.peugnet@free.fr>2021-09-13 13:27:57 +0200
commit7936be4619e10baae3cb2265169344245b1a7d13 (patch)
treed9ce49205bcbd6b9a3b554b33588eceab5df1dbd /repo.go
parent04bd3f8a7dc68050de8b0f9ab6876e67da6976b9 (diff)
downloaddna-backup-7936be4619e10baae3cb2265169344245b1a7d13.tar.gz
dna-backup-7936be4619e10baae3cb2265169344245b1a7d13.zip
close opened files in loadChunkContent and Restore
to try to fix tests on windows
Diffstat (limited to 'repo.go')
-rw-r--r--repo.go6
1 files changed, 6 insertions, 0 deletions
diff --git a/repo.go b/repo.go
index 07eb5ea..50eeb25 100644
--- a/repo.go
+++ b/repo.go
@@ -144,6 +144,9 @@ func (r *Repo) Restore(destination string) {
if err != nil {
log.Printf("Error storing file content for '%s', written %d/%d bytes: %s\n", filePath, n, file.Size, err)
}
+ if err := f.Close(); err != nil {
+ log.Printf("Error closing restored file '%s': %s\n", filePath, err)
+ }
}
}
@@ -276,6 +279,9 @@ func (r *Repo) LoadChunkContent(id *ChunkId) *bytes.Reader {
if err != nil {
log.Panicf("Could not read from chunk '%s': %s\n", path, err)
}
+ if err = f.Close(); err != nil {
+ log.Printf("Could not close chunk '%s': %s\n", path, err)
+ }
r.chunkCache.Set(id, value)
}
return bytes.NewReader(value)