()
| 475 | await fs.rename(temp, target); |
| 476 | return; |
| 477 | } catch (error) { |
| 478 | lastError = error; |
| 479 | if (error?.code === "EXDEV") |
| 480 | break; |
| 481 | if (!isRetriableStateWriteError(error)) |
| 482 | throw error; |
| 483 | if (attempt < attempts - 1) |
| 484 | await delay(25 * (attempt + 1)); |
| 485 | } |
| 486 | } |
| 487 | for (let attempt = 0;attempt < attempts; attempt++) { |
| 488 | try { |
| 489 | await fs.copyFile(temp, target); |
| 490 | return; |
| 491 | } catch (error) { |
| 492 | lastError = error; |
| 493 | if (!isRetriableStateWriteError(error)) |
| 494 | throw error; |
| 495 | if (attempt < attempts - 1) |
| 496 | await delay(25 * (attempt + 1)); |
| 497 | } |
| 498 | } |
| 499 | try { |
| 500 | await fs.writeFile(target, contents, encoding); |
no test coverage detected