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

Commit

Permalink
fix(fs): return after calling cb in chmod (#33)
Browse files Browse the repository at this point in the history
  • Loading branch information
jchip authored and zkat committed Nov 20, 2018
1 parent a33cca1 commit bd952d3
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/node/fs.js
Original file line number Diff line number Diff line change
Expand Up @@ -431,7 +431,7 @@ function overrideNode () {

patchFn('chmod', chmod => (p, mode, cb) => {
return chmod(p, mode, (err) => {
if (!err || err.code !== 'ENOENT') { cb(err) }
if (!err || err.code !== 'ENOENT') { return cb(err) }

const resolved = pkglock.resolve(p)
if (!resolved) {
Expand All @@ -441,9 +441,9 @@ function overrideNode () {
}

return mkdirp(path.dirname(p), err => {
if (err) { cb(err) }
if (err) { return cb(err) }
fs.readFile(p, (err, data) => {
if (err) { cb(err) }
if (err) { return cb(err) }
fs.writeFile(p, data, { mode }, cb)
})
})
Expand Down

0 comments on commit bd952d3

Please sign in to comment.