I want to create a child process with fork what can communicate with its parent. I'm using a Zig 0.16 nightly (0.16.0-dev.1976+8e091047b to be precise). What I see is that there is std.posix.fork and std.os.linux.pipe. I have a couple of questions:
- Is calling
forkthe best way to fork right now, or is ther a nicer wrapper somewhere instdthat I didn't see? pipereturns a file descriptor that I can use withstd.posix.readandstd.posix.write. Is there a way to warp this into anstd.Io.Filesomehow to get the nicer API?- More generally, is a
pipethe best way to communicate from child to parent?
I need communication only from child to parent and I want to sent arbitrary bytes. I guess I need to implement some kind of framing (e.g. headers telling me the size of the payload etc.), or are better means or a library that I could use?
Thank you! I've done some searching but I haven't found anything conclusive yet, so I'm asking here.