Skip to content

Commit

Permalink
win: let UV_PROCESS_WINDOWS_HIDE hide consoles
Browse files Browse the repository at this point in the history
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: nodejs/node#15380
Refs: joyent/libuv#627
Refs: libuv#965
PR-URL: libuv#1558
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Bartosz Sosnowski <bartosz@janeasystems.com>
  • Loading branch information
cjihrig committed Sep 25, 2017
1 parent 66b8b2f commit b21c1f9
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/win/process.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit b21c1f9

Please sign in to comment.