mirror of
https://github.com/restic/restic.git
synced 2026-11-10 08:41:00 +00:00
try deleting a directory before resetting the readonly status in tests
This commit is contained in:
1 parent
f394723aa2
commit
52cde35aea
1 file changed
+6
-2
@@ -195,8 +195,12 @@ func resetReadOnly(t testing.TB, dir string) {
|
||||
// afterwards uses os.RemoveAll() to remove the path.
|
||||
func RemoveAll(t testing.TB, path string) {
|
||||
t.Helper()
|
||||
resetReadOnly(t, path)
|
||||
err := os.RemoveAll(path)
|
||||
var err error
|
||||
err = os.RemoveAll(path)
|
||||
if err != nil {
|
||||
resetReadOnly(t, path)
|
||||
err = os.RemoveAll(path)
|
||||
}
|
||||
if errors.Is(err, os.ErrNotExist) {
|
||||
err = nil
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user