(oldPath: fs.PathLike, newPath: fs.PathLike)
| 363 | } |
| 364 | |
| 365 | async function renameUnderWindows(oldPath: fs.PathLike, newPath: fs.PathLike) { |
| 366 | // Windows malicious file analysis blocks files currently under analysis, so we need to wait for file release |
| 367 | const retries = 5; |
| 368 | for (let i = 0; i < retries; i++) { |
| 369 | try { |
| 370 | await fs.promises.rename(oldPath, newPath); |
| 371 | break; |
| 372 | } catch (err) { |
| 373 | if ( |
| 374 | nodeUtils.isNodeError(err) && (err.code === `ENOENT` || err.code === `EPERM`) && |
| 375 | i < (retries - 1) |
| 376 | ) { |
| 377 | await setTimeoutPromise(100 * 2 ** i); |
| 378 | continue; |
| 379 | } else { |
| 380 | throw err; |
| 381 | } |
| 382 | } |
| 383 | } |
| 384 | } |
| 385 | |
| 386 | /** |
| 387 | * Loads the binary, taking control of the current process. |
no outgoing calls
no test coverage detected
searching dependent graphs…