Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Don't create console window when creating process (#32379)
* fix: Don't create console window when creating process * Update patches/node/fix_don_t_create_console_window_when_creating_process.patch Co-authored-by: Robo <hop2deep@gmail.com> * Remove extra line in description * Update .patches Co-authored-by: Raymond Zhao <raymondzhao@microsoft.com> Co-authored-by: Raymond Zhao <rzhao271@gmail.com> Co-authored-by: Robo <hop2deep@gmail.com>
- Loading branch information
1 parent
59aba70
commit c5d5c28
Showing
2 changed files
with
26 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
patches/node/fix_don_t_create_console_window_when_creating_process.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 | ||
From: Raymond Zhao <raymondzhao@microsoft.com> | ||
Date: Tue, 4 Jan 2022 16:11:41 -0800 | ||
Subject: fix: Don't create console window when creating process | ||
|
||
This patch prevents console windows from being created during | ||
execSync calls, or spawnSync calls where shell is true. Otherwise, | ||
Windows users will see command prompts pop up for those calls. | ||
|
||
The patch has been upstreamed at https://github.com/nodejs/node/pull/41412. | ||
|
||
diff --git a/src/spawn_sync.cc b/src/spawn_sync.cc | ||
index 1141aceae984fba6ed07cd272a79d4007b9b03fe..afd08519d7f8974adff4060513f6160519a0b6b3 100644 | ||
--- a/src/spawn_sync.cc | ||
+++ b/src/spawn_sync.cc | ||
@@ -810,6 +810,9 @@ Maybe<int> SyncProcessRunner::ParseOptions(Local<Value> js_value) { | ||
if (js_win_hide->BooleanValue(isolate)) | ||
uv_process_options_.flags |= UV_PROCESS_WINDOWS_HIDE; | ||
|
||
+ if (env()->hide_console_windows()) | ||
+ uv_process_options_.flags |= UV_PROCESS_WINDOWS_HIDE_CONSOLE; | ||
+ | ||
Local<Value> js_wva = | ||
js_options->Get(context, env()->windows_verbatim_arguments_string()) | ||
.ToLocalChecked(); |