Skip to content

Commit 23d2876

Browse files
author
James Halliday
committed
passing umask sync test
1 parent 660c9df commit 23d2876

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

index.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@ var fs = require('fs');
44
module.exports = mkdirP.mkdirp = mkdirP.mkdirP = mkdirP;
55

66
function mkdirP (p, mode, f) {
7-
if (mode === undefined) throw new Error('mode not specified');
8-
if (typeof mode === 'function') {
7+
if (typeof mode === 'function' || mode === undefined) {
98
f = mode;
109
mode = 0777 & (~process.umask());
1110
}
@@ -42,7 +41,9 @@ function mkdirP (p, mode, f) {
4241
}
4342

4443
mkdirP.sync = function sync (p, mode) {
45-
if (mode === undefined) throw new Error('mode not specified');
44+
if (mode === undefined) {
45+
mode = 0777 & (~process.umask());
46+
}
4647

4748
if (typeof mode === 'string') mode = parseInt(mode, 8);
4849
p = path.resolve(p);

0 commit comments

Comments
 (0)