Merge: Windows: implement the `exec` module using `CreateProcess`
authorJean Privat <jean@pryen.org>
Mon, 27 Feb 2017 18:08:17 +0000 (13:08 -0500)
committerJean Privat <jean@pryen.org>
Mon, 27 Feb 2017 18:08:17 +0000 (13:08 -0500)
Until now, the `exec` services were implemented using the POSIX C functions `fork` and `execvp`. This PR introduces an alternative implement for Windows targets using `CreateProcess`.

The `exec` services are used by the compiler call external tools, most notably `pkg-config`. This should support more programs and tests with a dependency on native libraries.

The new `exec` implementation will probably need some tweaking. Testing under Windows is still problematic, but `test_exec` now passes, which is a good sign.

The `fflush` on every write is far from optimal and will slow down the compiler (and others). It solves an issue where a small write to the input of a subprocess would not be received by the subprocess. The data was probably kept in the write buffer (and not in the pipe buffer). I consider the use of `fflush` to be temporary until we have a better solution. Alternative (proven) solutions are welcome.

Pull-Request: #2375


Trivial merge