* Force-remove a lock file for a given version path. * Used when --force is specified to bypass stale locks.
(versionFilePath: string)
| 1169 | * Used when --force is specified to bypass stale locks. |
| 1170 | */ |
| 1171 | async function forceRemoveLock(versionFilePath: string): Promise<void> { |
| 1172 | const dirs = getBaseDirectories() |
| 1173 | const lockfilePath = getLockFilePathFromVersionPath(dirs, versionFilePath) |
| 1174 | |
| 1175 | try { |
| 1176 | await unlink(lockfilePath) |
| 1177 | logForDebugging(`Force-removed lock file at ${lockfilePath}`) |
| 1178 | } catch (error) { |
| 1179 | // Log but don't throw - we'll try to acquire the lock anyway |
| 1180 | logForDebugging(`Failed to force-remove lock file: ${errorMessage(error)}`) |
| 1181 | } |
| 1182 | } |
| 1183 | |
| 1184 | export async function cleanupOldVersions(): Promise<void> { |
| 1185 | // Yield to ensure we don't block startup |
no test coverage detected