win: let UV_PROCESS_WINDOWS_HIDE hide consoles

The existing UV_PROCESS_WINDOWS_HIDE flag only applies to
executables linked to the WINDOWS subsystem. This allows
CONSOLE subsystem applications to pop up a console
window. This commit sets the CREATE_NO_WINDOW process
flag when UV_PROCESS_WINDOWS_HIDE to prevent this behavior.

Refs: https://github.com/nodejs/node/pull/15380
Refs: https://github.com/joyent/libuv/pull/627
Refs: https://github.com/libuv/libuv/issues/965
PR-URL: https://github.com/libuv/libuv/pull/1558
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Bartosz Sosnowski <bartosz@janeasystems.com>
This commit is contained in:
cjihrig 2017-09-23 21:20:49 -04:00
parent 66b8b2f76d
commit b21c1f900c
No known key found for this signature in database
GPG Key ID: 7434390BDBE9B9C5

View File

@ -1058,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