Skip to content

Commit

Permalink
Fix panic when handling error in process dumping (#4525)
Browse files Browse the repository at this point in the history
Cannot use the `file` variable if we failed to create/open the file.
  • Loading branch information
rdner authored Apr 5, 2024
1 parent 1f90391 commit ad787a3
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion pkg/testing/fixture_install.go
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ func (f *Fixture) installNoPkgManager(ctx context.Context, installOpts *InstallO
f.t.Logf("Dumping running processes in %s", filePath)
file, err := os.OpenFile(filePath, os.O_CREATE|os.O_TRUNC|os.O_WRONLY, 0o644)
if err != nil {
f.t.Logf("failed to dump process; failed to create output file %s root: %s", file.Name(), err)
f.t.Logf("failed to dump process; failed to create output file %s root: %s", filePath, err)
return
}
defer func(file *os.File) {
Expand Down

0 comments on commit ad787a3

Please sign in to comment.