Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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 #1475 Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
- Loading branch information