File tree 5 files changed +16
-1
lines changed
5 files changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -877,6 +877,10 @@ inline bool Environment::tracks_unmanaged_fds() const {
877
877
return flags_ & EnvironmentFlags::kTrackUnmanagedFds ;
878
878
}
879
879
880
+ inline bool Environment::hide_console_windows () const {
881
+ return flags_ & EnvironmentFlags::kHideConsoleWindows ;
882
+ }
883
+
880
884
bool Environment::filehandle_close_warning () const {
881
885
return emit_filehandle_warning_;
882
886
}
Original file line number Diff line number Diff line change @@ -1198,6 +1198,7 @@ class Environment : public MemoryRetainer {
1198
1198
inline bool owns_process_state () const ;
1199
1199
inline bool owns_inspector () const ;
1200
1200
inline bool tracks_unmanaged_fds () const ;
1201
+ inline bool hide_console_windows () const ;
1201
1202
inline uint64_t thread_id () const ;
1202
1203
inline worker::Worker* worker_context () const ;
1203
1204
Environment* worker_parent_env () const ;
Original file line number Diff line number Diff line change @@ -402,7 +402,11 @@ enum Flags : uint64_t {
402
402
kNoRegisterESMLoader = 1 << 3 ,
403
403
// Set this flag to make Node.js track "raw" file descriptors, i.e. managed
404
404
// by fs.open() and fs.close(), and close them during FreeEnvironment().
405
- kTrackUnmanagedFds = 1 << 4
405
+ kTrackUnmanagedFds = 1 << 4 ,
406
+ // Set this flag to force hiding console windows when spawning child
407
+ // processes. This is usually used when embedding Node.js in GUI programs on
408
+ // Windows.
409
+ kHideConsoleWindows = 1 << 5
406
410
};
407
411
} // namespace EnvironmentFlags
408
412
Original file line number Diff line number Diff line change @@ -558,6 +558,8 @@ void Worker::New(const FunctionCallbackInfo<Value>& args) {
558
558
CHECK (args[4 ]->IsBoolean ());
559
559
if (args[4 ]->IsTrue () || env->tracks_unmanaged_fds ())
560
560
worker->environment_flags_ |= EnvironmentFlags::kTrackUnmanagedFds ;
561
+ if (env->hide_console_windows ())
562
+ worker->environment_flags_ |= EnvironmentFlags::kHideConsoleWindows ;
561
563
}
562
564
563
565
void Worker::StartThread (const FunctionCallbackInfo<Value>& args) {
Original file line number Diff line number Diff line change @@ -238,6 +238,10 @@ class ProcessWrap : public HandleWrap {
238
238
options.flags |= UV_PROCESS_WINDOWS_HIDE;
239
239
}
240
240
241
+ if (env->hide_console_windows ()) {
242
+ options.flags |= UV_PROCESS_WINDOWS_HIDE_CONSOLE;
243
+ }
244
+
241
245
// options.windows_verbatim_arguments
242
246
Local<Value> wva_v =
243
247
js_options->Get (context, env->windows_verbatim_arguments_string ())
You can’t perform that action at this time.
0 commit comments