Implement a custom spawnve() on Windows.
commit72d58fde995f38454069a9be80a747f0f1a844cc
authorJohannes Sixt <johannes.sixt@telecom.at>
Sat, 24 Nov 2007 21:49:16 +0000 (24 22:49 +0100)
committerJohannes Sixt <johannes.sixt@telecom.at>
Sun, 25 Nov 2007 19:18:37 +0000 (25 20:18 +0100)
tree39d1041ab6569d0b6ff66f350d558f11e4b00e0f
parenta020210cc8edd757b6e0f6d2ac1ba767f9d662ed
Implement a custom spawnve() on Windows.

The problem with Windows's own implementation is that it tries to be
clever when a console program is invoked from a GUI application: In this
case it sometimes automatically allocates a new console windows. As a
consequence, the IO channels of the spawned program are directed to the
console, but the invoking application listens on channels that are now
directed to nowhere.

In this implementation we use the lowlevel facilities of CreateProcess(),
which offers a flag to tell the system not to open a console. As a side
effect, only stdin, stdout, and stderr channels will be accessible from
C programs that are spawned. Other channels (file handles, pipe handles,
etc.) are still inherited by the spawned program, but it doesn't get
enough information to access them.

Johannes Schindelin integrated path quoting and unified the various
*execv* and *spawnv* helpers.

Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at>
compat/mingw.c