Skip to content

Commit ad787a3

Browse files
authored
Fix panic when handling error in process dumping (#4525)
Cannot use the `file` variable if we failed to create/open the file.
1 parent 1f90391 commit ad787a3

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

pkg/testing/fixture_install.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ func (f *Fixture) installNoPkgManager(ctx context.Context, installOpts *InstallO
189189
f.t.Logf("Dumping running processes in %s", filePath)
190190
file, err := os.OpenFile(filePath, os.O_CREATE|os.O_TRUNC|os.O_WRONLY, 0o644)
191191
if err != nil {
192-
f.t.Logf("failed to dump process; failed to create output file %s root: %s", file.Name(), err)
192+
f.t.Logf("failed to dump process; failed to create output file %s root: %s", filePath, err)
193193
return
194194
}
195195
defer func(file *os.File) {

0 commit comments

Comments
 (0)