Skip to content

Commit 04cbf3a

Browse files
authored
Merge pull request #1787 from dgageot/daily-fixes-2
Daily fixes for the Nightly issue detector
2 parents 060c2c2 + ce0795b commit 04cbf3a

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

cmd/root/root.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,9 @@ func isFirstRun() bool {
320320
if err != nil {
321321
return false // File already exists or other error, not first run
322322
}
323-
f.Close()
323+
if err := f.Close(); err != nil {
324+
slog.Warn("Failed to close first run marker file", "error", err)
325+
}
324326

325327
return true
326328
}

cmd/root/run.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,11 +142,12 @@ func (f *runExecFlags) runOrExec(ctx context.Context, out *cli.Printer, args []s
142142
if err != nil {
143143
return fmt.Errorf("failed to create CPU profile: %w", err)
144144
}
145-
defer pf.Close()
146145
if err := pprof.StartCPUProfile(pf); err != nil {
146+
pf.Close()
147147
return fmt.Errorf("failed to start CPU profile: %w", err)
148148
}
149149
defer pprof.StopCPUProfile()
150+
defer pf.Close()
150151
slog.Info("CPU profiling enabled", "file", f.cpuProfile)
151152
}
152153

0 commit comments

Comments
 (0)