Conversation
It's not OK to half-ass this function. Please implement it correctly, or not at all.
I think having inputs is problematic here, it should only be for outputs.
|
You can consider using |
No, nobody should use select for anything. See the warning right at the top of the linux man page: |
|
Just FYI, Windows uses a different ABI for |
That sounds pretty much like https://github.com/ziglang/zig/pull/14152/files#diff-e0931af874560c650fde2b1a0f92b99f2d32edb04a823cf99b6161f69f5997eaR1552-R1562 except for a socket instead of pipe. |
|
Here's the initial windows implementation: marler8997@82ff9da |
|
Would be nice to have the additional test, but I think this is safe to merge given how much test coverage it gets from the build system. Thanks @marler8997! |
Motivation
I need the logic from
std.ChildProcess.collectOutputfor some other work I'm doing in #14647. This is my attempt to extract it into a reusable abstraction. In short summary, the usage looks like this:Each stream gets a
std.fifo.LinearFifowhich can be accessed by e.g.poller.fifo(.stdout). You can do this inside the while loop, or you can just let it accumulate as I have done above.Testing
Here is the code I used to test this. Before merging this PR I will break it up into parent.zig and child.zig and move it to be a standalone test.
Merge Checklist
std.ChildProcess.collectOutputto use this abstraction. Most of that code can be deleted in theory, just need to add logic to limit tomax_output_bytes.