diff options
author | n-peugnet <n.peugnet@free.fr> | 2021-09-13 13:13:12 +0200 |
---|---|---|
committer | Nicolas Peugnet <n.peugnet@free.fr> | 2021-09-13 13:27:57 +0200 |
commit | 7936be4619e10baae3cb2265169344245b1a7d13 (patch) | |
tree | d9ce49205bcbd6b9a3b554b33588eceab5df1dbd | |
parent | 04bd3f8a7dc68050de8b0f9ab6876e67da6976b9 (diff) | |
download | dna-backup-7936be4619e10baae3cb2265169344245b1a7d13.tar.gz dna-backup-7936be4619e10baae3cb2265169344245b1a7d13.zip |
close opened files in loadChunkContent and Restore
to try to fix tests on windows
-rw-r--r-- | repo.go | 6 |
1 files changed, 6 insertions, 0 deletions
@@ -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) |