@wrongstack/persistence 0.306.2 → 0.306.3
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/dist/index.js +8 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -212,6 +212,13 @@ async function renameWithRetry(from, to) {
|
|
|
212
212
|
} catch (error) {
|
|
213
213
|
const code = error.code;
|
|
214
214
|
let transient = code !== void 0 && TRANSIENT_RENAME_CODES.has(code);
|
|
215
|
+
if (transient) {
|
|
216
|
+
try {
|
|
217
|
+
const target = await fs.stat(to);
|
|
218
|
+
if (target.isDirectory()) transient = false;
|
|
219
|
+
} catch {
|
|
220
|
+
}
|
|
221
|
+
}
|
|
215
222
|
if (code === "ENOENT") {
|
|
216
223
|
try {
|
|
217
224
|
await fs.stat(from);
|
|
@@ -223,7 +230,7 @@ async function renameWithRetry(from, to) {
|
|
|
223
230
|
if (!transient || attempt === delays.length) {
|
|
224
231
|
if (attempt === delays.length) {
|
|
225
232
|
process.emitWarning(
|
|
226
|
-
`Windows rename retries exhausted for '${from}' \u2192 '${to}' (code=${code}).
|
|
233
|
+
`Windows rename retries exhausted for '${from}' \u2192 '${to}' (code=${code}). Atomic write failed; the original target was left untouched.`,
|
|
227
234
|
{ code: "WRONGSTACK_WIN32_RENAME_EXHAUSTED" }
|
|
228
235
|
);
|
|
229
236
|
}
|