diff options
author | Brad King <brad.king@kitware.com> | 2018-01-22 15:18:39 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2018-01-22 15:18:44 (GMT) |
commit | 63f263b27fa9b9c63f038ff108118726bc9c5c64 (patch) | |
tree | 7022b7804d75353ed9d32570dff17b8ffe71feaf /Utilities/cmlibuv/src/win/process.c | |
parent | c81ace7ab7e5e325fef9339ed3ea05abbd0f8be4 (diff) | |
parent | 6db7b35236b81a73047a47c0f70f8befbf2ca51f (diff) | |
download | CMake-63f263b27fa9b9c63f038ff108118726bc9c5c64.zip CMake-63f263b27fa9b9c63f038ff108118726bc9c5c64.tar.gz CMake-63f263b27fa9b9c63f038ff108118726bc9c5c64.tar.bz2 |
Merge topic 'update-libuv'
6db7b352 libuv: Update build within CMake
b58d48c1 Merge branch 'upstream-libuv' into update-libuv
f4a26c74 libuv 2018-01-19 (63de1eca)
e8b57c22 libuv: Teach import script to add missing newlines
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !1666
Diffstat (limited to 'Utilities/cmlibuv/src/win/process.c')
-rw-r--r-- | Utilities/cmlibuv/src/win/process.c | 31 |
1 files changed, 26 insertions, 5 deletions
diff --git a/Utilities/cmlibuv/src/win/process.c b/Utilities/cmlibuv/src/win/process.c index d141601..cc06d9e 100644 --- a/Utilities/cmlibuv/src/win/process.c +++ b/Utilities/cmlibuv/src/win/process.c @@ -405,8 +405,15 @@ static WCHAR* search_path(const WCHAR *file, /* Next slice starts just after where the previous one ended */ dir_start = dir_end; + /* If path is quoted, find quote end */ + if (*dir_start == L'"' || *dir_start == L'\'') { + dir_end = wcschr(dir_start + 1, *dir_start); + if (dir_end == NULL) { + dir_end = wcschr(dir_start, L'\0'); + } + } /* Slice until the next ; or \0 is found */ - dir_end = wcschr(dir_start, L';'); + dir_end = wcschr(dir_end, L';'); if (dir_end == NULL) { dir_end = wcschr(dir_start, L'\0'); } @@ -1051,15 +1058,18 @@ int uv_spawn(uv_loop_t* loop, startup.hStdOutput = uv__stdio_handle(process->child_stdio_buffer, 1); startup.hStdError = uv__stdio_handle(process->child_stdio_buffer, 2); + process_flags = CREATE_UNICODE_ENVIRONMENT; + if (options->flags & UV_PROCESS_WINDOWS_HIDE) { /* Use SW_HIDE to avoid any potential process window. */ startup.wShowWindow = SW_HIDE; + + /* Hide console windows. */ + process_flags |= CREATE_NO_WINDOW; } else { startup.wShowWindow = SW_SHOWDEFAULT; } - process_flags = CREATE_UNICODE_ENVIRONMENT; - if (options->flags & UV_PROCESS_DETACHED) { /* Note that we're not setting the CREATE_BREAKAWAY_FROM_JOB flag. That * means that libuv might not let you create a fully daemonized process @@ -1163,6 +1173,10 @@ int uv_spawn(uv_loop_t* loop, static int uv__kill(HANDLE process_handle, int signum) { + if (signum < 0 || signum >= NSIG) { + return UV_EINVAL; + } + switch (signum) { case SIGTERM: case SIGKILL: @@ -1227,8 +1241,15 @@ int uv_process_kill(uv_process_t* process, int signum) { int uv_kill(int pid, int signum) { int err; - HANDLE process_handle = OpenProcess(PROCESS_TERMINATE | - PROCESS_QUERY_INFORMATION, FALSE, pid); + HANDLE process_handle; + + if (pid == 0) { + process_handle = GetCurrentProcess(); + } else { + process_handle = OpenProcess(PROCESS_TERMINATE | PROCESS_QUERY_INFORMATION, + FALSE, + pid); + } if (process_handle == NULL) { err = GetLastError(); |