diff options
author | Gar <gar+gh@danger.computer> | 2022-03-14 23:53:34 +0300 |
---|---|---|
committer | nlf <nlf@github.com> | 2022-03-15 23:38:37 +0300 |
commit | e26548fb12a3bb23fbe32a336f1305e083aa51c0 (patch) | |
tree | abc72b0d62357e79bb1d5626a553c9e4de85bb68 /node_modules/cacache/lib/util/fix-owner.js | |
parent | f6b771aabece09dca2231426d4f681d3578e5ab7 (diff) |
deps: cacache@16.0.0
Diffstat (limited to 'node_modules/cacache/lib/util/fix-owner.js')
-rw-r--r-- | node_modules/cacache/lib/util/fix-owner.js | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/node_modules/cacache/lib/util/fix-owner.js b/node_modules/cacache/lib/util/fix-owner.js index 90ffece52..bc14def4e 100644 --- a/node_modules/cacache/lib/util/fix-owner.js +++ b/node_modules/cacache/lib/util/fix-owner.js @@ -49,8 +49,9 @@ function fixOwner (cache, filepath) { const { uid, gid } = owner // No need to override if it's already what we used. - if (self.uid === uid && self.gid === gid) + if (self.uid === uid && self.gid === gid) { return + } return inflight('fixOwner: fixing ownership on ' + filepath, () => chownr( @@ -58,8 +59,9 @@ function fixOwner (cache, filepath) { typeof uid === 'number' ? uid : self.uid, typeof gid === 'number' ? gid : self.gid ).catch((err) => { - if (err.code === 'ENOENT') + if (err.code === 'ENOENT') { return null + } throw err }) @@ -93,8 +95,9 @@ function fixOwnerSync (cache, filepath) { ) } catch (err) { // only catch ENOENT, any other error is a problem. - if (err.code === 'ENOENT') + if (err.code === 'ENOENT') { return null + } throw err } @@ -110,12 +113,14 @@ function mkdirfix (cache, p, cb) { return Promise.resolve(inferOwner(cache)).then(() => { return mkdirp(p) .then((made) => { - if (made) + if (made) { return fixOwner(cache, made).then(() => made) + } }) .catch((err) => { - if (err.code === 'EEXIST') + if (err.code === 'EEXIST') { return fixOwner(cache, p).then(() => null) + } throw err }) @@ -136,7 +141,8 @@ function mkdirfixSync (cache, p) { if (err.code === 'EEXIST') { fixOwnerSync(cache, p) return null - } else + } else { throw err + } } } |