diff options
author | Brad King <brad.king@kitware.com> | 2024-05-22 18:00:04 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2024-05-22 18:58:06 (GMT) |
commit | a5903828501ce21c81d49d49f80704b714a8bffc (patch) | |
tree | 5abbed4b163d6061200f86385151744ba60b7012 /Utilities | |
parent | 32a8d5a4acee9d116031d7e54a90000940f03a50 (diff) | |
download | CMake-a5903828501ce21c81d49d49f80704b714a8bffc.zip CMake-a5903828501ce21c81d49d49f80704b714a8bffc.tar.gz CMake-a5903828501ce21c81d49d49f80704b714a8bffc.tar.bz2 |
libuv: win/spawn: disable extra-file-descriptor support not needed by CMake
Upstream libuv supports passing file descriptors >= 3 to child processes
via `STARTUPINFOW` members reserved by the MSVC C run-time. However,
some programs use `GetStartupInfoW` to initialize a `STARTUPINFOW`
structure to pass to `CreateProcessW` without clearing the reserved
members. If we launch such programs with non-zero values in the
reserved members, the MSVC C run-time in *their* children may not
correctly associate the stdin/stdout/stderr streams' file descriptors
with the corresponding `HANDLE`s.
Patch our copy of libuv to avoid using the reserved members. This
restores `execute_process` support for the above-described programs as
we had prior to commit 5420639a8d (cmExecuteProcessCommand: Replace
cmsysProcess with cmUVProcessChain, 2023-06-01, v3.28.0-rc1~138^2~8).
It also enables support for such programs when launched by `ctest`.
Fixes: #25996
Fixes: #25889
Diffstat (limited to 'Utilities')
-rw-r--r-- | Utilities/cmlibuv/src/win/process.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/Utilities/cmlibuv/src/win/process.c b/Utilities/cmlibuv/src/win/process.c index 11cf5b2..5cf9fb8 100644 --- a/Utilities/cmlibuv/src/win/process.c +++ b/Utilities/cmlibuv/src/win/process.c @@ -1083,8 +1083,15 @@ int uv_spawn(uv_loop_t* loop, startup.lpTitle = NULL; startup.dwFlags = STARTF_USESTDHANDLES | STARTF_USESHOWWINDOW; +#if 1 + /* cmake does not need libuv's support for passing file descriptors >= 3 + to the MSVC C run-time in the child. Avoid using reserved members. */ + startup.cbReserved2 = 0; + startup.lpReserved2 = NULL; +#else startup.cbReserved2 = uv__stdio_size(process->child_stdio_buffer); startup.lpReserved2 = (BYTE*) process->child_stdio_buffer; +#endif startup.hStdInput = uv__stdio_handle(process->child_stdio_buffer, 0); startup.hStdOutput = uv__stdio_handle(process->child_stdio_buffer, 1); |