077a1d5769 libuv: win/spawn: optionally run executable paths with no file extension
f02ac51150 libuv: Revert "win/spawn: run executables with no file extension"
58a271e60b cmUVProcessChain: Implement no-extension-on-Windows support with libuv 1.48
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !9238
Backport libuv commit `3f7191e5` (win/spawn: optionally run executable
paths with no file extension, 2024-02-05, v1.48.0~8) to add the
`UV_PROCESS_WINDOWS_FILE_PATH_EXACT_NAME` option we now use.
Issue: #25450
On Windows, in a GUI process without a console, the `std{in,out,err}`
standard FILE streams may not be open. Avoid passing an invalid file
descriptor to the child process, and let libuv attach NUL instead.
Fixes: #25625
`include-what-you-use` diagnostics, in practice, are specific to
the environment's compiler and standard library. Update includes
to satisfy IWYU for our CI job under Debian 12.
Previously, we were letting libuv create the output pipe for each
process. However, in order to facilitate use cases where process
spawn is expected to fail (in the case of a missing executable), we
want pipe creation to be separate from process creation. Manually
create all of the pipes.
Move most of cmUVProcessChain::InternalData::Finish() to Prepare()
so that error codes can be checked before attepting to spawn any
processes. Check some error codes that weren't being checked before.
Change return type of Finish() to void as it can't fail.
Provide a standardized way to handle the C++ "standard" headers
customized to be used with current CMake C++ standard constraints.
Offer under directory `cm` headers which can be used as direct
replacements of the standard ones. For example:
#include <cm/string_view>
can be used safely for CMake development in place of the `<string_view>`
standard header.
Fixes: #19491
Some static analysis tools throw a false positive for an
out-of-bounds item that is being dereferenced. This out-of-bounds
error will never actually happen because of how
cmUVProcessChain::InternalData::AddCommand() is being called.
Nevertheless, this change adds an assert() to help static analysis
tools be absolutely certain that the referenced item is within the
vector's bounds.
This change also changes the item access to use an index rather
than an iterator.
This class is ultimately intended as a replacement for cmsys::Process.
It spawns a series of processes using libuv, piping the output of each
command into the next.
Note: input support has not yet been implemented because write
support has not yet been implemented on cmUVStreambuf.