* Force-remove a lock file for a given version path. * Used when --force is specified to bypass stale locks.
(versionFilePath: string)
| 1157 | * Used when --force is specified to bypass stale locks. |
| 1158 | */ |
| 1159 | async function forceRemoveLock(versionFilePath: string): Promise<void> { |
| 1160 | const dirs = getBaseDirectories() |
| 1161 | const lockfilePath = getLockFilePathFromVersionPath(dirs, versionFilePath) |
| 1162 | |
| 1163 | try { |
| 1164 | await unlink(lockfilePath) |
| 1165 | logForDebugging(`Force-removed lock file at ${lockfilePath}`) |
| 1166 | } catch (error) { |
| 1167 | // Log but don't throw - we'll try to acquire the lock anyway |
| 1168 | logForDebugging(`Failed to force-remove lock file: ${errorMessage(error)}`) |
| 1169 | } |
| 1170 | } |
| 1171 | |
| 1172 | export async function cleanupOldVersions(): Promise<void> { |
| 1173 | // Yield to ensure we don't block startup |
no test coverage detected