zig/lib/std/Build
mlugg 048e85f27e
std.process.Child: add waitForSpawn
`std.Build.Step.Run` makes the very reasonable assumption that
`error.InvalidExe` will be reported on `spawn` if it will happen.
However, this property does not currently hold on POSIX targets. This
is, through a slightly convoluted series of events, partially
responsible for the sporadic `BrokenPipe` errors we've been seeing more
and more in CI runs.

Making `spawn` wait for the child to exec in the POSIX path introduces
a block of up to 400us. So, instead of doing that, we add a new API for
this particular case: `waitForSpawn`. This function is a nop on Windows,
but on POSIX it blocks until the child successfully (or otherwise) calls
`execvpe`, and reports the error if necessary. `std.Build.Step.Run`
calls this function, so that it can get `error.InvalidExe` when it wants
it.

I'm not convinced that this API is optimal. However, I think this entire
API needs to be either heavily refactored or straight-up redesigned
(related: #22504), so I'm not too worried about hitting the perfect API:
I'd rather just fix this bug for now, and figure out the long-term goal
a bit later.
2025-01-20 00:27:19 +00:00
..
Cache std.Build.Cache.Path: fix single-quote escaping format 2024-10-10 14:21:52 -07:00
Fuzz Replace deprecated default initializations with decl literals 2024-09-12 16:01:23 +01:00
Step std.process.Child: add waitForSpawn 2025-01-20 00:27:19 +00:00
Cache.zig std.Build.Cache.hit: work around macOS kernel bug 2024-12-11 11:56:44 -08:00
Fuzz.zig Replace deprecated default initializations with decl literals 2024-09-12 16:01:23 +01:00
Module.zig std.Build: simplify module dependency handling 2024-12-18 01:47:51 +05:00
Step.zig std.Build.Cache.hit: work around macOS kernel bug 2024-12-11 11:56:44 -08:00
Watch.zig std.Build.Watch: implement removing watches for kqueue 2024-10-24 23:31:56 -07:00