mirror of
https://github.com/Kitware/CMake.git
synced 2025-10-17 07:11:52 +08:00
libuv: win,spawn: allow %PATH% to be unset
Backport libuv commit `c97017dd` (win,spawn: allow `%PATH%` to be unset, 2023-08-14). See https://github.com/libuv/libuv/pull/4116.
This commit is contained in:
@@ -394,7 +394,7 @@ static WCHAR* search_path(const WCHAR *file,
|
||||
name_has_ext);
|
||||
|
||||
while (result == NULL) {
|
||||
if (*dir_end == L'\0') {
|
||||
if (dir_end == NULL || *dir_end == L'\0') {
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -1027,11 +1027,7 @@ int uv_spawn(uv_loop_t* loop,
|
||||
DWORD path_len, r;
|
||||
|
||||
path_len = GetEnvironmentVariableW(L"PATH", NULL, 0);
|
||||
if (path_len == 0) {
|
||||
err = GetLastError();
|
||||
goto done;
|
||||
}
|
||||
|
||||
if (path_len != 0) {
|
||||
alloc_path = (WCHAR*) uv__malloc(path_len * sizeof(WCHAR));
|
||||
if (alloc_path == NULL) {
|
||||
err = ERROR_OUTOFMEMORY;
|
||||
@@ -1045,6 +1041,7 @@ int uv_spawn(uv_loop_t* loop,
|
||||
goto done;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
err = uv__stdio_create(loop, options, &process->child_stdio_buffer);
|
||||
if (err)
|
||||
|
Reference in New Issue
Block a user