From: Tay Date: Sat, 21 Mar 2026 20:17:12 +0000 (-0700) Subject: commands: Close cpu profile file when StartCPUProfile fails X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=9dd9c7602728df6cfebe04115b40d9e01a428e45;p=brevno-suite%2Fhugo commands: Close cpu profile file when StartCPUProfile fails --- diff --git a/commands/hugobuilder.go b/commands/hugobuilder.go index 559a79362..4037f6611 100644 --- a/commands/hugobuilder.go +++ b/commands/hugobuilder.go @@ -179,6 +179,7 @@ func (c *hugoBuilder) initCPUProfile() (func(), error) { return nil, fmt.Errorf("failed to create CPU profile: %w", err) } if err := pprof.StartCPUProfile(f); err != nil { + f.Close() return nil, fmt.Errorf("failed to start CPU profile: %w", err) } return func() {