|
@@ -411,10 +411,9 @@ func profileProtoReader(path string, ui plugin.UI) (io.ReadCloser, error) {
|
411
|
411
|
}
|
412
|
412
|
profileFile, openErr := os.Open(profileFilePath)
|
413
|
413
|
if openErr != nil {
|
414
|
|
- os.Remove(profileFilePath)
|
415
|
414
|
return nil, openErr
|
416
|
415
|
}
|
417
|
|
- return DeleteOnClose(profileFile), nil
|
|
416
|
+ return profileFile, nil
|
418
|
417
|
}
|
419
|
418
|
return sourceFile, nil
|
420
|
419
|
}
|
|
@@ -431,8 +430,10 @@ func convertPerfData(perfPath string, ui plugin.UI) (string, error) {
|
431
|
430
|
return "", err
|
432
|
431
|
}
|
433
|
432
|
cmd := exec.Command("perf_to_profile", perfPath, profilePath)
|
|
433
|
+ // If perf_to_profile failed before generating the file, this defer
|
|
434
|
+ // is just a no-op.
|
|
435
|
+ deferDeleteTempFile(profilePath)
|
434
|
436
|
if err := cmd.Run(); err != nil {
|
435
|
|
- os.Remove(profilePath)
|
436
|
437
|
return "", err
|
437
|
438
|
}
|
438
|
439
|
return profilePath, nil
|