-
Kenton Varda authored
On Windows, we don't have `fork()` and `exec()`, but rather `spawn()`, which does both in one call. This makes FD inheritance hard -- the parent process has to set up its own FD table to be what it wants the child to receive, then call spawn(), then set things back. `capnp` does all that, but there was a problem: when it created a pipe, it failed to set the FDs as non-inheritable (Windows equivalent of CLOEXEC). Thus the child would implicitly inherit both ends of the pipe without knowing it. Since it would never close the write end, it would never receive EOF on the read end. The fix turns out to be simple: create the pipe non-inheritable. We are already separately using `dup2()` to create the copy of the descriptor that we actually want inherited. Fixes #488.
a65bce17