cacache 17.1.1 → 17.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -168,18 +168,21 @@ async function moveToDestination (tmp, cache, sri, opts) {
168
168
  moveOperations.set(
169
169
  destination,
170
170
  fs.mkdir(destDir, { recursive: true })
171
- .then(() => moveFile(tmp.target, destination, { overwrite: false }))
171
+ .then(async () => {
172
+ await moveFile(tmp.target, destination, { overwrite: false })
173
+ tmp.moved = true
174
+ return tmp.moved
175
+ })
176
+ .catch(err => {
177
+ if (!err.message.startsWith('The destination file exists')) {
178
+ throw Object.assign(err, { code: 'EEXIST' })
179
+ }
180
+ }).finally(() => {
181
+ moveOperations.delete(destination)
182
+ })
183
+
172
184
  )
173
- try {
174
- await moveOperations.get(destination)
175
- tmp.moved = true
176
- } catch (err) {
177
- if (!err.message.startsWith('The destination file exists')) {
178
- throw Object.assign(err, { code: 'EEXIST' })
179
- }
180
- } finally {
181
- moveOperations.delete(destination)
182
- }
185
+ return moveOperations.get(destination)
183
186
  }
184
187
 
185
188
  function sizeError (expected, found) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cacache",
3
- "version": "17.1.1",
3
+ "version": "17.1.2",
4
4
  "cache-version": {
5
5
  "content": "2",
6
6
  "index": "5"