Skip to content

Commit 467a02c

Browse files
author
Per Goncalves da Silva
committed
fixes
Signed-off-by: Per Goncalves da Silva <[email protected]>
1 parent eae523a commit 467a02c

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

internal/fsutil/helpers.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package util
1+
package fsutil
22

33
import (
44
"io/fs"
@@ -8,7 +8,9 @@ import (
88

99
// EnsureEmptyDirectory ensures the directory given by `path` is empty.
1010
// If the directory does not exist, it will be created with permission bits
11-
// given by `perm`.
11+
// given by `perm`. If the directory exists, it will not simply rm -rf && mkdir -p
12+
// as the calling process may not have permissions to delete the directory. E.g.
13+
// in the case of a pod mount. Rather, it will delete the contents of the directory.
1214
func EnsureEmptyDirectory(path string, perm fs.FileMode) error {
1315
entries, err := os.ReadDir(path)
1416
if err != nil && !os.IsNotExist(err) {

0 commit comments

Comments
 (0)