Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #15 from bryanmacfarlane/master

rmRf silently failing on readonly file in windows
  • Loading branch information...
commit 3043e6729538d3ef38549f36522e8d649799f1ee 2 parents 77fcd5e + 341ae36
@mde authored
Showing with 10 additions and 1 deletion.
  1. +10 −1 lib/file.js
View
11 lib/file.js
@@ -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);
Please sign in to comment.
Something went wrong with that request. Please try again.