diff options
| author | mlugg <mlugg@mlugg.co.uk> | 2025-01-10 10:27:32 +0000 |
|---|---|---|
| committer | mlugg <mlugg@mlugg.co.uk> | 2025-01-20 00:27:19 +0000 |
| commit | 048e85f27e805f51c214e8e87e91a367a2873328 (patch) | |
| tree | 9c159bc7888a9b3d758aa0c4ec6145f773354165 /src/codegen | |
| parent | b8e568504e1dca38273a5845ac20d056cd7db5bb (diff) | |
| download | zig-048e85f27e805f51c214e8e87e91a367a2873328.tar.gz zig-048e85f27e805f51c214e8e87e91a367a2873328.zip | |
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.
Diffstat (limited to 'src/codegen')
0 files changed, 0 insertions, 0 deletions
