Skip to content

Commit 294124d

Browse files
authored
Close the temp file when dumping database to make the temp file can be deleted on Windows (#23249)
There was no `dbDump.Close()` before, Windows doesn't like to delete opened files.
1 parent ea1d097 commit 294124d

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

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)