Files
git/compat
Johannes Schindelin dc364ab06b fixup! mingw: spawned processes need to inherit only standard handles
On Windows 7 and older, the API to restrict which file handles get
to be inherited by a spawned process is a bit peculiar. For example,
when launching `git ls-remote https://...` in a Git Bash, everything
works as expected. But when launching that in a Git CMD,
CreateProcessW() will fail (with an ERROR_NO_SYSTEM_RESOURCES) if even
one of the standard handles are marked to be inherited specifically.

Apparently, it has something to do with handles' file types and with
cmd.exe setting up its standard handles in a specific way.

Rather than trying to guess correctly under which circumstances we
should, or should not, list those standard handles, let's just work
around this by detecting that particular error and simply trying to call
CreateProcessW() again, this time without any special thread attribute
list to restrict which handles get to be inherited by the spawned
process.

This means that we potentially run into more locking problems on Windows
7 and older than we would like, but it is still better than to deny Git
to spawn any child processes.

This fixes https://github.com/git-for-windows/git/issues/1475

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2018-02-05 21:31:34 +01:00
..
2017-07-05 14:01:03 -07:00
2017-07-05 14:01:03 -07:00
2018-01-22 13:00:12 +01:00
2018-01-22 13:00:05 +01:00
2018-01-22 13:00:02 +01:00
2017-01-23 11:02:34 -08:00
2018-01-22 13:00:12 +01:00