aboutsummaryrefslogtreecommitdiffstats
path: root/cmd
diff options
context:
space:
mode:
authorwxiaoguang <wxiaoguang@gmail.com>2023-03-02 23:57:31 +0800
committerGitHub <noreply@github.com>2023-03-02 23:57:31 +0800
commit294124d129b12673109767abd331c78c71e3bf2c (patch)
tree3d59539160776693710d97b4ecae792adb5c164f /cmd
parentea1d09718ce2e3bf043c60bae76dd6bd7e84e9fe (diff)
downloadgitea-294124d129b12673109767abd331c78c71e3bf2c.tar.gz
gitea-294124d129b12673109767abd331c78c71e3bf2c.zip
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.
Diffstat (limited to 'cmd')
-rw-r--r--cmd/dump.go1
1 files changed, 1 insertions, 0 deletions
diff --git a/cmd/dump.go b/cmd/dump.go
index c879d2fbee..600ec4f32e 100644
--- a/cmd/dump.go
+++ b/cmd/dump.go
@@ -272,6 +272,7 @@ func runDump(ctx *cli.Context) error {
fatal("Failed to create tmp file: %v", err)
}
defer func() {
+ _ = dbDump.Close()
if err := util.Remove(dbDump.Name()); err != nil {
log.Warn("Unable to remove temporary file: %s: Error: %v", dbDump.Name(), err)
}