mirror of
https://github.com/apple/sourcekit-lsp.git
synced 2026-11-03 05:11:06 +01:00
On Windows, a compiler holds a lock file in the module cache while it builds an implicit module and only removes it when it exits normally. `LockFileManager` can only tell that the owner of a lock file is gone on Unix, so other compilers wait for the full lock timeout before building the module themselves. Terminating an index compiler when its task is cancelled, which happens whenever a server shuts down, thus stalls unrelated compiler invocations that share the module cache. Terminating `swiftc` has the same effect as terminating the frontend because, for a single job, the driver runs the frontend in a job object that is terminated together with the driver. Add `ProcessCancellationBehavior` so that callers can choose to let a process run until it exits when the waiting task is cancelled, and use it for index compiler invocations on Windows. The index store update timeout was implemented by cancelling the task, so it now terminates the process explicitly instead, which keeps terminating compilers that don't finish within the timeout.