mirror of
				https://gitee.com/gitea/gitea
				synced 2025-11-04 08:30:25 +08:00 
			
		
		
		
	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.
This commit is contained in:
		@@ -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)
 | 
			
		||||
		}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user