()
| 23 | const worker = path.join(import.meta.dir, "../fixture/flock-worker.ts") |
| 24 | |
| 25 | async function tmpdir() { |
| 26 | const dir = await fs.mkdtemp(path.join(os.tmpdir(), "flock-test-")) |
| 27 | return { |
| 28 | path: dir, |
| 29 | async [Symbol.asyncDispose]() { |
| 30 | await fs.rm(dir, { recursive: true, force: true }) |
| 31 | }, |
| 32 | } |
| 33 | } |
| 34 | |
| 35 | function lock(dir: string, key: string) { |
| 36 | return path.join(dir, Hash.fast(key) + ".lock") |