Permalink
Browse files

Merge pull request #15 from bryanmacfarlane/master

rmRf silently failing on readonly file in windows
  • Loading branch information...
2 parents 77fcd5e + 341ae36 commit 3043e6729538d3ef38549f36522e8d649799f1ee @mde committed Feb 18, 2014
Showing with 10 additions and 1 deletion.
  1. +10 −1 lib/file.js
View
@@ -170,7 +170,16 @@ var fileUtils = new (function () {
_rmDir(curr);
}
else {
- fs.unlinkSync(curr);
+ try {
+ fs.unlinkSync(curr);
+ } catch(e) {
+ if (e.code === 'EPERM') {
+ fs.chmodSync(curr, '0666');
+ fs.unlinkSync(curr);
+ } else {
+ throw e;
+ }
+ }
}
});
fs.rmdirSync(dir);

0 comments on commit 3043e67

Please sign in to comment.