Skip to content

Commit 37b4415

Browse files
committed
Handle windows EPERM when lstat-ing RO dirs
Ideally, this should fix #105
1 parent ef032b6 commit 37b4415

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

rimraf.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,10 @@ function rimraf_ (p, options, cb) {
135135
if (er && er.code === "ENOENT")
136136
return cb(null)
137137

138+
// Windows can EPERM on stat. Life is suffering.
139+
if (er && er.code === "EPERM" && isWindows)
140+
fixWinEPERM(p, options, er, cb)
141+
138142
if (st && st.isDirectory())
139143
return rmdir(p, options, er, cb)
140144

@@ -287,6 +291,10 @@ function rimrafSync (p, options) {
287291
} catch (er) {
288292
if (er.code === "ENOENT")
289293
return
294+
295+
// Windows can EPERM on stat. Life is suffering.
296+
if (er.code === "EPERM" && isWindows)
297+
fixWinEPERMSync(p, options, er)
290298
}
291299

292300
try {

0 commit comments

Comments
 (0)