(locksDir: string)
| 350 | * Get information about all version locks for diagnostics |
| 351 | */ |
| 352 | export function getAllLockInfo(locksDir: string): LockInfo[] { |
| 353 | const fs = getFsImplementation() |
| 354 | const lockInfos: LockInfo[] = [] |
| 355 | |
| 356 | try { |
| 357 | const lockFiles = fs |
| 358 | .readdirStringSync(locksDir) |
| 359 | .filter((f: string) => f.endsWith('.lock')) |
| 360 | |
| 361 | for (const lockFile of lockFiles) { |
| 362 | const lockFilePath = join(locksDir, lockFile) |
| 363 | const content = readLockContent(lockFilePath) |
| 364 | |
| 365 | if (content) { |
| 366 | lockInfos.push({ |
| 367 | version: content.version, |
| 368 | pid: content.pid, |
| 369 | isProcessRunning: isProcessRunning(content.pid), |
| 370 | execPath: content.execPath, |
| 371 | acquiredAt: new Date(content.acquiredAt), |
| 372 | lockFilePath, |
| 373 | }) |
| 374 | } |
| 375 | } |
| 376 | } catch (error) { |
| 377 | if (isENOENT(error)) { |
| 378 | return lockInfos |
| 379 | } |
| 380 | logError(toError(error)) |
| 381 | } |
| 382 | |
| 383 | return lockInfos |
| 384 | } |
| 385 | |
| 386 | /** |
| 387 | * Clean up stale locks (locks where the process is no longer running) |
no test coverage detected