diff options
author | isaacs <i@izs.me> | 2012-06-05 02:55:09 +0400 |
---|---|---|
committer | isaacs <i@izs.me> | 2012-06-05 02:55:09 +0400 |
commit | 1690b529ed1d406cdd813db1da338b4c0e1c200e (patch) | |
tree | a9896a3f046d5b78348735d9bd1c44d1f8e90305 /node_modules/mkdirp | |
parent | 57e635331b71a63bbf075f5d6dc485cd7086d55f (diff) |
Bump mkdirp for EISDIR/EPERM failure
Diffstat (limited to 'node_modules/mkdirp')
-rw-r--r-- | node_modules/mkdirp/README.markdown | 7 | ||||
-rw-r--r-- | node_modules/mkdirp/index.js | 25 | ||||
-rw-r--r-- | node_modules/mkdirp/package.json | 12 |
3 files changed, 29 insertions, 15 deletions
diff --git a/node_modules/mkdirp/README.markdown b/node_modules/mkdirp/README.markdown index b4dd75fdc..40de04f71 100644 --- a/node_modules/mkdirp/README.markdown +++ b/node_modules/mkdirp/README.markdown @@ -3,6 +3,8 @@ mkdirp Like `mkdir -p`, but in node.js! +[![build status](https://secure.travis-ci.org/substack/node-mkdirp.png)](http://travis-ci.org/substack/node-mkdirp) + example ======= @@ -33,6 +35,9 @@ permission string `mode`. If `mode` isn't specified, it defaults to `0777 & (~process.umask())`. +`cb(err, made)` fires with the error or the first directory `made` +that had to be created, if any. + mkdirp.sync(dir, mode) ---------------------- @@ -41,6 +46,8 @@ with octal permission string `mode`. If `mode` isn't specified, it defaults to `0777 & (~process.umask())`. +Returns the first directory that had to be created, if any. + install ======= diff --git a/node_modules/mkdirp/index.js b/node_modules/mkdirp/index.js index 871488f63..874b31095 100644 --- a/node_modules/mkdirp/index.js +++ b/node_modules/mkdirp/index.js @@ -3,14 +3,12 @@ var fs = require('fs'); module.exports = mkdirP.mkdirp = mkdirP.mkdirP = mkdirP; -function mkdirP (p, mode, f) { +function mkdirP (p, mode, f, made) { if (typeof mode === 'function' || mode === undefined) { f = mode; mode = 0777 & (~process.umask()); } - - // secret passalong argument. - var made = arguments[3] || null; + if (!made) made = null; var cb = f || function () {}; if (typeof mode === 'string') mode = parseInt(mode, 8); @@ -29,10 +27,21 @@ function mkdirP (p, mode, f) { }); break; + case 'EISDIR': + case 'EPERM': + // Operation not permitted or already is a dir. + // This is the error you get when trying to mkdir('c:/') + // on windows, or mkdir('/') on unix. Make sure it's a + // dir by falling through to the EEXIST case. + case 'EROFS': + // a read-only file system. + // However, the dir could already exist, in which case + // the EROFS error will be obscuring a EEXIST! + // Fallthrough to that case. case 'EEXIST': fs.stat(p, function (er2, stat) { // if the stat fails, then that's super weird. - // let the original EEXIST be the failure reason. + // let the original error be the failure reason. if (er2 || !stat.isDirectory()) cb(er, made) else cb(null, made); }); @@ -45,13 +54,11 @@ function mkdirP (p, mode, f) { }); } -mkdirP.sync = function sync (p, mode) { +mkdirP.sync = function sync (p, mode, made) { if (mode === undefined) { mode = 0777 & (~process.umask()); } - - // secret passalong argument - var made = arguments[2] || null; + if (!made) made = null; if (typeof mode === 'string') mode = parseInt(mode, 8); p = path.resolve(p); diff --git a/node_modules/mkdirp/package.json b/node_modules/mkdirp/package.json index 2a40503c5..2a393e97a 100644 --- a/node_modules/mkdirp/package.json +++ b/node_modules/mkdirp/package.json @@ -1,7 +1,7 @@ { "name": "mkdirp", "description": "Recursively mkdir, like `mkdir -p`", - "version": "0.3.0", + "version": "0.3.2", "author": { "name": "James Halliday", "email": "mail@substack.net", @@ -20,7 +20,7 @@ "test": "tap test/*.js" }, "devDependencies": { - "tap": "0.2" + "tap": "~0.2.4" }, "license": "MIT/X11", "engines": { @@ -30,15 +30,15 @@ "name": "isaacs", "email": "i@izs.me" }, - "_id": "mkdirp@0.3.0", + "_id": "mkdirp@0.3.2", "dependencies": {}, "optionalDependencies": {}, "_engineSupported": true, - "_npmVersion": "1.1.13", - "_nodeVersion": "v0.7.7-pre", + "_npmVersion": "1.1.23", + "_nodeVersion": "v0.7.10-pre", "_defaultsLoaded": true, "dist": { - "shasum": "a3cc6816e78b84f570caf9d95cb7368dc5d0bab8" + "shasum": "bebd1a16759571a6bd30f89a7edffc38ad442881" }, "_from": "../mkdirp" } |