We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent eae523a commit 467a02cCopy full SHA for 467a02c
internal/fsutil/helpers.go
@@ -1,4 +1,4 @@
1
-package util
+package fsutil
2
3
import (
4
"io/fs"
@@ -8,7 +8,9 @@ import (
8
9
// EnsureEmptyDirectory ensures the directory given by `path` is empty.
10
// If the directory does not exist, it will be created with permission bits
11
-// given by `perm`.
+// 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.
14
func EnsureEmptyDirectory(path string, perm fs.FileMode) error {
15
entries, err := os.ReadDir(path)
16
if err != nil && !os.IsNotExist(err) {
0 commit comments