mirror of
https://github.com/trufflesecurity/trufflehog.git
synced 2024-11-10 07:04:24 +00:00
Wrap temp deletion err #2277
This commit is contained in:
parent
6b8573d3ea
commit
fd8e5e9df6
1 changed files with 3 additions and 2 deletions
|
@ -100,13 +100,14 @@ func CleanTempArtifacts(ctx logContext.Context) error {
|
||||||
|
|
||||||
if shouldDelete {
|
if shouldDelete {
|
||||||
path := filepath.Join(tempDir, entry.Name())
|
path := filepath.Join(tempDir, entry.Name())
|
||||||
if entry.IsDir() {
|
isDir := entry.IsDir()
|
||||||
|
if isDir {
|
||||||
err = os.RemoveAll(path)
|
err = os.RemoveAll(path)
|
||||||
} else {
|
} else {
|
||||||
err = os.Remove(path)
|
err = os.Remove(path)
|
||||||
}
|
}
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("error deleting temp artifact: %s", path)
|
return fmt.Errorf("error deleting temp artifact (dir: %v) %s: %w", isDir, path, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx.Logger().V(4).Info("Deleted orphaned temp artifact", "artifact", path)
|
ctx.Logger().V(4).Info("Deleted orphaned temp artifact", "artifact", path)
|
||||||
|
|
Loading…
Reference in a new issue