mirror of
https://github.com/ziglang/zig.git
synced 2025-12-06 14:23:09 +00:00
Currently, the new API will only be available on macOS with the intention of adding more POSIX systems to it incrementally (such as Linux, etc.). Changes: * add `posix_spawn` wrappers in a separate container in `os/posix_spawn.zig` * rewrite `ChildProcess.spawnPosix` using `posix_spawn` targeting macOS as `ChildProcess.spawnMacos` * introduce a `posix_spawn` specific `std.c.waitpid` wrapper which does return an error in case the child process failed to exec - this is required for any process that was spawned using `posix_spawn` mechanism as, by definition, the errors returned by `posix_spawn` routine cover only the `fork`-equivalent; `pre-exec()` and `exec()` steps are covered by a catch-all error `ECHILD` returned by `waitpid` on unsuccessful execution, e.g., no such file error, etc.