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