You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 592408f
Browse filesBrowse the repository at this point in the historyBrowse files
Yannic Charlon
committed
run-command: add an opt-in posix_spawn backend on macOS
Platforms that can start child programs but cannot duplicate the parent
process cannot use the POSIX start_command() path. It always calls
fork(), even when the platform supplies a spawn API.
Add USE_POSIX_SPAWN as an opt-in macOS prototype. Keep the existing fork
backend as the default. Reuse command preparation, environment deltas
and child cleanup, and translate the child setup into spawn file
actions and attributes. Preserve the ENOEXEC shell fallback and the
synchronous error reporting expected by start_command() callers.
The macOS implementation provides a concrete place to discuss the
backend boundary before adding another target. It relies on macOS
spawn extensions for cwd and descriptor inheritance. It is not a WASM
port: NO_PTHREADS start_async() still calls fork(), and no wasm child
process has been run with this change.
The RFC question is whether a posix_spawn backend is the right direction
for platforms without fork, or whether Git would prefer a small platform
hook like the existing Windows launch path.
With the opt-in backend, t0061 preloads a macOS test library that makes
fork() return ENOSYS. A canary requires that failure before the launch,
cwd, environment, pipe, error and fallback cases run. The tests call
binaries directly because macOS strips DYLD_* from shell wrappers.
On macOS arm64, DEVELOPER=1 builds and t0061 pass with both backends:
26 cases, with three MINGW skips for spawn and an additional canary
skip for the default backend. Without the test library, the canary
fails as expected. A separate external-alias control also fails on the
default backend when fork() returns ENOSYS.
Meson keeps the prototype disabled. Provide its empty build-option
substitution so the shared template also configures under Meson's
fatal-warning checks. Meson 1.10.1 configuration passes with those checks.
AI assistance: GPT-6.1 Sol and GPT-6 Luna through the Codex harness.
Signed-off-by: Yannic Charlon <justyannicc.8tlny@simplelogin.com>
0 commit comments