Skip to content
This repository has been archived by the owner on Aug 11, 2021. It is now read-only.

[BUG] update to mkdirp ≥ 1 #69

Open
guimard opened this issue Oct 23, 2020 · 1 comment
Open

[BUG] update to mkdirp ≥ 1 #69

guimard opened this issue Oct 23, 2020 · 1 comment

Comments

@guimard
Copy link

guimard commented Oct 23, 2020

What / Why

mkdirp is outdated.

Proposed patch:

--- a/lib/dir-writer.js
+++ b/lib/dir-writer.js
@@ -31,12 +31,12 @@

 DirWriter.prototype._create = function () {
   var self = this
-  mkdir(self._path, Writer.dirmode, function (er) {
-    if (er) return self.error(er)
-    // ready to start getting entries!
+  mkdir(self._path, Writer.dirmode).then( () => {
     self.ready = true
     self.emit('ready')
     self._process()
+  }).catch( (er) => {
+    return self.error(er)
   })
 }

--- a/lib/writer.js
+++ b/lib/writer.js
@@ -166,13 +166,13 @@

   // XXX Need to clobber non-dirs that are in the way,
   // unless { clobber: false } in the props.
-  mkdir(path.dirname(self._path), Writer.dirmode, function (er, made) {
-    // console.error("W created", path.dirname(self._path), er)
-    if (er) return self.error(er)
-
+  mkdir(path.dirname(self._path), Writer.dirmode).then( (made) => {
     // later on, we have to set the mode and owner for these
     self._madeDir = made
     return self._create()
+  }).catch( (er) => {
+    // console.error("W created", path.dirname(self._path), er)
+    return self.error(er)
   })
 }
@ThomasThelen
Copy link

Linking to #68 which completely removes the dependancy.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants