Support Darwin subprocess working directories with posix_spawn - #4951
Closed
ecpeterson wants to merge 1 commit into
Closed
ecpeterson wants to merge 1 commit into
ecpeterson wants to merge 1 commit into
Conversation
Collaborator
|
@ecpeterson nice contribution! just to avoid platform specific ifdefs being too mingled in the code (which we try to avoid) I made a commit that stacks on top of yours that factors out a subprocess_for_os layer with an associated bazel configuration flag for which source file to use in #4972 |
Contributor
Author
|
@cdleary back at you, nice project :) Prasahnt put me on to it, and it’s been a treat to explore. I hope union types for tagged tuples land soon! I’ll close this in favor of your version. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR was primarily authored by Codex.
Darwin builds of
xls/common/subprocess.cccurrently encounter Linux-onlymemfdsupport and the/proc/self/fdhelper path. Useposix_spawnpdirectly on Darwin, with a child working-directory file action when requested. The Linux embedded-helper path and shared spawn setup retain their existing variable names and comments.Apple's macOS 26 SDK introduces
posix_spawn_file_actions_addchdirand deprecates the_npspelling. XLS still targets macOS 10.15. When the SDK declares the standard function, an availability check selects it on macOS 26 or later and retains_npfor older supported systems. Builds whose minimum target is already macOS 26 use only the standard function; builds using older SDKs retain the older spelling. This avoids requiring a macOS 26 symbol on the earlier supported deployment targets.The child keeps the existing argument, environment, output-capture, and timeout handling. New tests exercise PATH lookup with a child working directory, verify that the parent directory stays unchanged, and run an executable addressed relative to the child directory. Existing tests cover output capture, exit status, timeouts, and environment additions.
Validation: formatting, absolute-include checks, and
git diff --checkpass. A standalone probe of the API-selection helper compiled with deprecation and unguarded-availability warnings treated as errors for x86_64/macOS 10.15, arm64/macOS 11, and arm64/macOS 26 deployment targets; its native spawn/chdir smoke test passed. The full//xls/common:subprocess_testtarget passed all 14 tests on native Apple Silicon, including the new working-directory cases and the existing timeout/output/environment cases. Linux execution and execution on older macOS versions remain untested.