* Make a fresh ` /.tmp/` directory, removing any pre-existing * orphaned tmp from a prior aborted run. Using `mkdtemp` would dodge * the rm step but would make the rename target unpredictable; this * way the temp path is stable (` /.tmp`) so a SIGKILL between two * runs doesn't leave a t
(dir: string)
| 485 | * runs doesn't leave a tree of `.tmp.<rand>` directories. |
| 486 | */ |
| 487 | async function freshTmpDir(dir: string): Promise<string> { |
| 488 | const tmpDir = join(dir, '.tmp'); |
| 489 | await rm(tmpDir, { recursive: true, force: true }); |
| 490 | await mkdir(tmpDir, { recursive: true }); |
| 491 | return tmpDir; |
| 492 | } |
| 493 | |
| 494 | /** |
| 495 | * Rename `<tmp>/<file>` → `<dir>/<file>` for every file in `files`. |