Permalink
Browse files

apply writable check to sync case, also

  • Loading branch information...
1 parent 9035368 commit df9982ca0162819206e8002d9313d9f21dbd44d0 @isaacs committed Jan 30, 2012
Showing with 6 additions and 0 deletions.
  1. +6 −0 rimraf.js
View
@@ -156,7 +156,13 @@ function rimrafSync (p) {
if (er.code === "ENOENT") return
throw er
}
+
+ if (!writable(s)) {
+ fs.chmodSync(p, s.mode | 0222), function (er) {
+ }
+
if (!s.isDirectory()) return fs.unlinkSync(p)
+
fs.readdirSync(p).forEach(function (f) {
rimrafSync(path.join(p, f))
})

0 comments on commit df9982c

Please sign in to comment.