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.
- package/lib/content/write.js +14 -11
- package/package.json +1 -1
package/lib/content/write.js
CHANGED
|
@@ -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(() =>
|
|
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
|
-
|
|
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) {
|