ziglang / zig

General-purpose programming language and toolchain for maintaining robust, optimal, and reusable software.
https://ziglang.org
MIT License
35.25k stars 2.57k forks source link

open a communication channel between the build system and application #20604

Open andrewrk opened 4 months ago

andrewrk commented 4 months ago

Extracted from #20580.

When the build system spawns a child process via a Run step, unless opted out, give it an environment variable that communicates a file descriptor which is a pipe. For example, ZIG_BUILD=4. This file descriptor is an open pipe so that the application can speak the zig build system protocol, which will be available in the Zig standard library for convenience.

This will enable the following use cases:

Of course, applications are free to simply ignore this open pipe as well, just like they can ignore stdin, stdout, or stderr.

mnemnion commented 4 months ago

Will the use of a protocol-specific pipe open the door for a fix for #15091/#18111 ?