Merge topic 'libuv-1.48'
merge-requests/9236/merge077a1d5769
libuv: win/spawn: optionally run executable paths with no file extensionf02ac51150
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
commit
a67d9b5c07
|
@ -337,6 +337,11 @@ void cmUVProcessChain::InternalData::SpawnProcess(
|
|||
arguments.push_back(nullptr);
|
||||
options.args = const_cast<char**>(arguments.data());
|
||||
options.flags = UV_PROCESS_WINDOWS_HIDE;
|
||||
#if UV_VERSION_MAJOR > 1 || \
|
||||
(UV_VERSION_MAJOR == 1 && UV_VERSION_MINOR >= 48) || \
|
||||
!defined(CMAKE_USE_SYSTEM_LIBUV)
|
||||
options.flags |= UV_PROCESS_WINDOWS_FILE_PATH_EXACT_NAME;
|
||||
#endif
|
||||
if (!this->Builder->WorkingDirectory.empty()) {
|
||||
options.cwd = this->Builder->WorkingDirectory.c_str();
|
||||
}
|
||||
|
|
|
@ -1080,7 +1080,14 @@ enum uv_process_flags {
|
|||
* option is only meaningful on Windows systems. On Unix it is silently
|
||||
* ignored.
|
||||
*/
|
||||
UV_PROCESS_WINDOWS_HIDE_GUI = (1 << 6)
|
||||
UV_PROCESS_WINDOWS_HIDE_GUI = (1 << 6),
|
||||
/*
|
||||
* On Windows, if the path to the program to execute, specified in
|
||||
* uv_process_options_t's file field, has a directory component,
|
||||
* search for the exact file name before trying variants with
|
||||
* extensions like '.exe' or '.cmd'.
|
||||
*/
|
||||
UV_PROCESS_WINDOWS_FILE_PATH_EXACT_NAME = (1 << 7)
|
||||
};
|
||||
|
||||
/*
|
||||
|
|
|
@ -1008,6 +1008,7 @@ int uv_spawn(uv_loop_t* loop,
|
|||
assert(!(options->flags & ~(UV_PROCESS_DETACHED |
|
||||
UV_PROCESS_SETGID |
|
||||
UV_PROCESS_SETUID |
|
||||
UV_PROCESS_WINDOWS_FILE_PATH_EXACT_NAME |
|
||||
UV_PROCESS_WINDOWS_HIDE |
|
||||
UV_PROCESS_WINDOWS_HIDE_CONSOLE |
|
||||
UV_PROCESS_WINDOWS_HIDE_GUI |
|
||||
|
|
|
@ -329,10 +329,9 @@ static WCHAR* path_search_walk_ext(const WCHAR *dir,
|
|||
* - If there's really only a filename, check the current directory for file,
|
||||
* then search all path directories.
|
||||
*
|
||||
* - If a full path is specified, search for the exact filename first.
|
||||
*
|
||||
* - If filename specified has *any* extension, search for the file with the
|
||||
* specified extension first.
|
||||
* - If filename specified has *any* extension, or already contains a path
|
||||
* and the UV_PROCESS_WINDOWS_FILE_PATH_EXACT_NAME flag is specified,
|
||||
* search for the file with the exact specified filename first.
|
||||
*
|
||||
* - If the literal filename is not found in a directory, try *appending*
|
||||
* (not replacing) .com first and then .exe.
|
||||
|
@ -358,7 +357,8 @@ static WCHAR* path_search_walk_ext(const WCHAR *dir,
|
|||
*/
|
||||
static WCHAR* search_path(const WCHAR *file,
|
||||
WCHAR *cwd,
|
||||
const WCHAR *path) {
|
||||
const WCHAR *path,
|
||||
unsigned int flags) {
|
||||
int file_has_dir;
|
||||
WCHAR* result = NULL;
|
||||
WCHAR *file_name_start;
|
||||
|
@ -394,14 +394,12 @@ static WCHAR* search_path(const WCHAR *file,
|
|||
name_has_ext = (dot != NULL && dot[1] != L'\0');
|
||||
|
||||
if (file_has_dir) {
|
||||
/* The file has a path inside, don't use path
|
||||
* Try the exact filename first, and then try standard extensions
|
||||
*/
|
||||
/* The file has a path inside, don't use path */
|
||||
result = path_search_walk_ext(
|
||||
file, file_name_start - file,
|
||||
file_name_start, file_len - (file_name_start - file),
|
||||
cwd, cwd_len,
|
||||
1);
|
||||
name_has_ext || (flags & UV_PROCESS_WINDOWS_FILE_PATH_EXACT_NAME));
|
||||
|
||||
} else {
|
||||
dir_end = path;
|
||||
|
@ -991,6 +989,7 @@ int uv_spawn(uv_loop_t* loop,
|
|||
assert(!(options->flags & ~(UV_PROCESS_DETACHED |
|
||||
UV_PROCESS_SETGID |
|
||||
UV_PROCESS_SETUID |
|
||||
UV_PROCESS_WINDOWS_FILE_PATH_EXACT_NAME |
|
||||
UV_PROCESS_WINDOWS_HIDE |
|
||||
UV_PROCESS_WINDOWS_HIDE_CONSOLE |
|
||||
UV_PROCESS_WINDOWS_HIDE_GUI |
|
||||
|
@ -1070,7 +1069,8 @@ int uv_spawn(uv_loop_t* loop,
|
|||
|
||||
application_path = search_path(application,
|
||||
cwd,
|
||||
path);
|
||||
path,
|
||||
options->flags);
|
||||
if (application_path == NULL) {
|
||||
/* Not found. */
|
||||
err = ERROR_FILE_NOT_FOUND;
|
||||
|
|
Loading…
Reference in New Issue