Skip to content

Commit b21c1f9

Browse files
committed
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: nodejs/node#15380 Refs: joyent/libuv#627 Refs: #965 PR-URL: #1558 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Bartosz Sosnowski <bartosz@janeasystems.com>
1 parent 66b8b2f commit b21c1f9

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

src/win/process.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1058,15 +1058,18 @@ int uv_spawn(uv_loop_t* loop,
10581058
startup.hStdOutput = uv__stdio_handle(process->child_stdio_buffer, 1);
10591059
startup.hStdError = uv__stdio_handle(process->child_stdio_buffer, 2);
10601060

1061+
process_flags = CREATE_UNICODE_ENVIRONMENT;
1062+
10611063
if (options->flags & UV_PROCESS_WINDOWS_HIDE) {
10621064
/* Use SW_HIDE to avoid any potential process window. */
10631065
startup.wShowWindow = SW_HIDE;
1066+
1067+
/* Hide console windows. */
1068+
process_flags |= CREATE_NO_WINDOW;
10641069
} else {
10651070
startup.wShowWindow = SW_SHOWDEFAULT;
10661071
}
10671072

1068-
process_flags = CREATE_UNICODE_ENVIRONMENT;
1069-
10701073
if (options->flags & UV_PROCESS_DETACHED) {
10711074
/* Note that we're not setting the CREATE_BREAKAWAY_FROM_JOB flag. That
10721075
* means that libuv might not let you create a fully daemonized process

0 commit comments

Comments
 (0)