diff options
author | Gar <gar+gh@danger.computer> | 2021-05-27 20:11:48 +0300 |
---|---|---|
committer | Gar <gar+gh@danger.computer> | 2021-05-27 20:11:48 +0300 |
commit | 7b56bfdf3f2ac67a926fc7893b883a16b46eb3fd (patch) | |
tree | ac34f8a016c3815a07b6d5767da8c5285404e3da /node_modules/cacache/lib/util/fix-owner.js | |
parent | b70d797d5dd45a0f557615820a9409b66850c896 (diff) |
cacache@15.2.0
* feat: allow fully deleting indices
* feat: add a validateEntry option to compact
* chore: lint
* chore: use standard npm style release scripts
Diffstat (limited to 'node_modules/cacache/lib/util/fix-owner.js')
-rw-r--r-- | node_modules/cacache/lib/util/fix-owner.js | 21 |
1 files changed, 9 insertions, 12 deletions
diff --git a/node_modules/cacache/lib/util/fix-owner.js b/node_modules/cacache/lib/util/fix-owner.js index 9afa638a8..90ffece52 100644 --- a/node_modules/cacache/lib/util/fix-owner.js +++ b/node_modules/cacache/lib/util/fix-owner.js @@ -49,9 +49,8 @@ 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( @@ -59,9 +58,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 }) ) @@ -94,9 +93,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 } } @@ -111,14 +110,13 @@ 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 }) }) @@ -138,8 +136,7 @@ function mkdirfixSync (cache, p) { if (err.code === 'EEXIST') { fixOwnerSync(cache, p) return null - } else { + } else throw err - } } } |