On Thu, Aug 10, 2023 at 02:19:40 -0700, EShuman wrote:
> Hello!
>
> On Windows, when Ninja creates a Subprocess to compile a file, it redirects
> the Subprocess's std::out and std::err to read dependencies from it:
Well, stdout is for dependencies. stderr is for diagnostics (`ninja`
batches output per `build` rule to avoid interleaved output).
> startup_info.hStdOutput = child_pipe;
> startup_info.hStdError = child_pipe;
>
> I am using a custom compiler that, after compiling a file, prints the
> dependencies to std::err. In my case, printing to std::err might take about
> 2-3 seconds.
> I tried to exclude Ninja from the process of reading from std::err by
> redirecting the Subprocess's std::err to nul:
>
> startup_info.hStdError = nul;
>
> With this change, writing to std::err only takes a few microseconds.
How are users expected to get diagnostics from the compiler if `stderr`
is dropped on the floor? Or get correct dependencies if using your
custom compiler for that matter?
> Is there a way to fix this issue and improve interprocess communication
> speed on Windows?
--Ben