Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP


set mode properly, even if dir exists #9

isaacs opened this Issue · 0 comments

2 participants


When the callback is called, the thing should be a dir with the expected mode.

@substack substack closed this issue from a commit
@isaacs isaacs Fix #8, fix #9, and fewer stat calls
The new algorithm is:

1. Try to make the dir.  If that works, then great.
2. If there's an ENOENT or ENOTDIR, then mkdirP the parent.
  1. If that fails, then fail.  Otherwise, try again.
3. If there's an EEXIST, then stat the thing
  1. if it's not a dir, delete it, and try again.
  2. if the mode is wrong, chmod it.
  3. otherwise, all is good, so just cb()
4. Some other error, fail with it.
@substack substack closed this in c4bdf27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.