Skip to content

Commit 9843a0b

Browse files
GiteaBotwxiaoguang
andauthored
Close the temp file when dumping database to make the temp file can be deleted on Windows (#23249) (#23251)
Backport #23249 There was no `dbDump.Close()` before, Windows doesn't like to delete opened files. Co-authored-by: wxiaoguang <[email protected]>
1 parent 085a4de commit 9843a0b

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

Diff for: cmd/dump.go

+1
Original file line numberDiff line numberDiff line change
@@ -272,6 +272,7 @@ func runDump(ctx *cli.Context) error {
272272
fatal("Failed to create tmp file: %v", err)
273273
}
274274
defer func() {
275+
_ = dbDump.Close()
275276
if err := util.Remove(dbDump.Name()); err != nil {
276277
log.Warn("Unable to remove temporary file: %s: Error: %v", dbDump.Name(), err)
277278
}

0 commit comments

Comments
 (0)