Skip to content
This repository was archived by the owner on Sep 1, 2023. It is now read-only.

Remove heap dump addon files as well #2

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions cleanup/cleanup.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,17 @@ func CleanUp(fs afero.Fs, cfg Config) ([]string, error) {
}

deletedFiles = append(deletedFiles, path)

// SAP JVM also creates .addons files that should be removed as well
addonPath := path[0:len(path)-len(".hprof")] + ".addons"
addonFile, err := fs.Stat(addonPath)
if !os.IsNotExist(err) && addonFile.Mode().isRegular() {
var err = fs.Remove(addonPath)
if err != nil {
return nil, fmt.Errorf("Cannot delete heap dump addon file '"+addonPath+"': %v", err)
}
deletedFiles = append(deletedFiles, addonPath)
}
}

return deletedFiles, nil
Expand Down