(dir?: string)
| 53 | } |
| 54 | |
| 55 | async function readLock(dir?: string): Promise<SchedulerLock | undefined> { |
| 56 | let raw: string |
| 57 | try { |
| 58 | raw = await readFile(getLockPath(dir), 'utf8') |
| 59 | } catch { |
| 60 | return undefined |
| 61 | } |
| 62 | const result = schedulerLockSchema().safeParse(safeParseJSON(raw, false)) |
| 63 | return result.success ? result.data : undefined |
| 64 | } |
| 65 | |
| 66 | async function tryCreateExclusive( |
| 67 | lock: SchedulerLock, |
no test coverage detected