Permalink
Browse files

rmRf silently failing on readonly file in windows

  • Loading branch information...
1 parent 77fcd5e commit 341ae36fcf18f6ccbb6f7587a90119e720b5fe26 @bryanmacfarlane bryanmacfarlane 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 341ae36

Please sign in to comment.