execute_process: 3.28 regresses standard input handle inheritance behavior
When execute_process
is used to run a process with no INPUT_FILE
argument the stdin
handle is supposed to be inherited from CMake itself.
Commit 5420639a changed how this command handles this causing processes to inherit an invalid handle.
Because of this change vcpkg now fails to run cmake.exe -E tar xzf <filename>
commands, which it runs during initial setup. When vcpkg tries to spawn the cmake subprocess it passes the standard input handle. CreateProcessW
fails because the handle is invalid.
The problem seems to occur because the wrong function is used to set the standard handle: https://gitlab.kitware.com/cmake/cmake/-/blob/v3.28.1/Source/cmExecuteProcessCommand.cxx#L189-192
But note that setting input as built-in is apparently unfinished: https://gitlab.kitware.com/cmake/cmake/-/blob/v3.28.1/Source/cmUVProcessChain.cxx#L170
My analysis of the problem as originally discovered in vcpkg can be found here: https://github.com/microsoft/vcpkg/issues/33904#issuecomment-1906074716