Skip to content

Find, verify, and analyze leaked credentials

Adds basic if/else check if pid slice is empty (#2244)

Mike Vanbuskirkadba91da5039
diff --git a/pkg/cleantemp/cleantemp.go b/pkg/cleantemp/cleantemp.go
index b638aeb70..2c1bbf7e9 100644
--- a/pkg/cleantemp/cleantemp.go
+++ b/pkg/cleantemp/cleantemp.go
@@ -70,6 +70,10 @@ func CleanTempArtifacts(ctx logContext.Context) error {
}
for _, artifact := range artifacts {
+ if len(pids) == 0 {
+ ctx.Logger().Info("No trufflehog processes were found")
+ continue
+ }
if trufflehogRE.MatchString(artifact.Name()) {
// Mark these artifacts initially as ones that should be deleted.
shouldDelete := true