File tree 2 files changed +9
-1
lines changed 2 files changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -8,6 +8,7 @@ package os
8
8
9
9
import (
10
10
"io"
11
+ "runtime"
11
12
"syscall"
12
13
)
13
14
@@ -127,6 +128,13 @@ func removeAll(path string) error {
127
128
if err1 == nil || IsNotExist (err1 ) {
128
129
return nil
129
130
}
131
+ if runtime .GOOS == "windows" && IsPermission (err1 ) {
132
+ if fs , err := Stat (path ); err == nil {
133
+ if err = Chmod (path , FileMode (0200 | int (fs .Mode ()))); err == nil {
134
+ err1 = Remove (path )
135
+ }
136
+ }
137
+ }
130
138
if err == nil {
131
139
err = err1
132
140
}
Original file line number Diff line number Diff line change @@ -378,7 +378,7 @@ func TestRemoveAllButReadOnlyAndPathError(t *testing.T) {
378
378
379
379
func TestRemoveUnreadableDir (t * testing.T ) {
380
380
switch runtime .GOOS {
381
- case "js" , "windows" :
381
+ case "js" :
382
382
t .Skipf ("skipping test on %s" , runtime .GOOS )
383
383
}
384
384
You can’t perform that action at this time.
0 commit comments