-
Notifications
You must be signed in to change notification settings - Fork 256
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Figure out how to set the working directory for spawned processes on all platforms #1271
Labels
Comments
ahoppen
added a commit
to ahoppen/sourcekit-lsp
that referenced
this issue
May 9, 2024
Details from apple#1271 > Amazon Linux 2 and CentOS 7 have a glibc that doesn’t support `posix_spawn_file_actions_addchdir_np` and thus `TSCBasic.Process` can’t launch a process on these platforms with the working directory set. We currently fall back to launching the index tasks without a working directory on these platforms, which I think is fine because SwiftPM gives us compiler arguments with absolute paths. But we should figure something out. > > Using `Foundation.Process` is not an option because it runs `chdir` on the current process for Posix platforms, which is racy if there are multiple subprocesses being spawned simultaneously. On Windows `TSCBasic.Processs` uses `Foundation.Process` and `Foundation.Process` properly set the working directory of the subprocesses on Windows, so Windows is not a problem. rdar://127797048
Synced to Apple’s issue tracker as rdar://128016626 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Amazon Linux 2 and CentOS 7 have a glibc that doesn’t support
posix_spawn_file_actions_addchdir_np
and thusTSCBasic.Process
can’t launch a process on these platforms with the working directory set. We currently fall back to launching the index tasks without a working directory on these platforms, which I think is fine because SwiftPM gives us compiler arguments with absolute paths. But we should figure something out.Using
Foundation.Process
is not an option because it runschdir
on the current process for Posix platforms, which is racy if there are multiple subprocesses being spawned simultaneously. On WindowsTSCBasic.Processs
usesFoundation.Process
andFoundation.Process
properly set the working directory of the subprocesses on Windows, so Windows is not a problem.The text was updated successfully, but these errors were encountered: