Skip to content

Commit

Permalink
build: add option to hide console window
Browse files Browse the repository at this point in the history
  • Loading branch information
zcbenz committed Aug 9, 2021
1 parent 6145113 commit 0a32a0c
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
7 changes: 7 additions & 0 deletions configure.py
Original file line number Diff line number Diff line change
Expand Up @@ -710,6 +710,12 @@
help='do not export browser globals like setTimeout, console, etc. ' +
'(This mode is not officially supported for regular applications)')

parser.add_argument('--hide-console-window',
action='store_true',
dest='hide_console_window',
default=None,
help='always hide console window when spawning new processes on Windows')

parser.add_argument('--without-inspector',
action='store_true',
dest='without_inspector',
Expand Down Expand Up @@ -1305,6 +1311,7 @@ def configure_node(o):
o['variables']['debug_nghttp2'] = 'false'

o['variables']['node_no_browser_globals'] = b(options.no_browser_globals)
o['variables']['node_hide_console_window'] = b(options.hide_console_window)

o['variables']['node_shared'] = b(options.shared)
node_module_version = getmoduleversion.get_version()
Expand Down
3 changes: 3 additions & 0 deletions node.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,9 @@
[ 'node_no_browser_globals=="true"', {
'defines': [ 'NODE_NO_BROWSER_GLOBALS' ],
} ],
[ 'node_hide_console_window=="true"', {
'defines': [ 'NODE_HIDE_CONSOLE_WINDOW' ],
} ],
[ 'node_shared_zlib=="false"', {
'dependencies': [ 'deps/zlib/zlib.gyp:zlib' ],
'conditions': [
Expand Down
4 changes: 4 additions & 0 deletions src/process_wrap.cc
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,10 @@ class ProcessWrap : public HandleWrap {
options.flags |= UV_PROCESS_WINDOWS_HIDE;
}

#if defined(NODE_HIDE_CONSOLE_WINDOW)
options.flags |= UV_PROCESS_WINDOWS_HIDE_CONSOLE;
#endif

// options.windows_verbatim_arguments
Local<Value> wva_v =
js_options->Get(context, env->windows_verbatim_arguments_string())
Expand Down

0 comments on commit 0a32a0c

Please sign in to comment.