( workspaceKey: string, options?: DaemonFileCleanupOptions, )
| 322 | * Remove daemon metadata and socket for a workspace when owned or provably stale. |
| 323 | */ |
| 324 | export function cleanupWorkspaceDaemonFiles( |
| 325 | workspaceKey: string, |
| 326 | options?: DaemonFileCleanupOptions, |
| 327 | ): void { |
| 328 | const result = withDaemonRegistryMutationLock(workspaceKey, () => { |
| 329 | const registryPath = registryPathForWorkspaceKey(workspaceKey); |
| 330 | const removed = removeRegistryAtPathIfOwned(registryPath, workspaceKey, options); |
| 331 | if (!removed) { |
| 332 | return; |
| 333 | } |
| 334 | |
| 335 | try { |
| 336 | unlinkSync(removed.socketPath); |
| 337 | } catch { |
| 338 | // ignore |
| 339 | } |
| 340 | }); |
| 341 | if (result === null) { |
| 342 | throw new Error(`Unable to acquire daemon registry lock for ${workspaceKey}`); |
| 343 | } |
| 344 | } |
no test coverage detected