mirror of
https://github.com/restic/restic.git
synced 2026-06-27 02:54:19 +00:00
try deleting a directory before resetting the readonly status in tests
This commit is contained in:
@@ -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