fix: console window popping up when --enable-logging passed on windows (#30375)
This commit is contained in:
parent
40e76dca07
commit
a17e48061a
2 changed files with 30 additions and 0 deletions
|
@ -102,3 +102,4 @@ refactor_restore_base_adaptcallbackforrepeating.patch
|
||||||
hack_to_allow_gclient_sync_with_host_os_mac_on_linux_in_ci.patch
|
hack_to_allow_gclient_sync_with_host_os_mac_on_linux_in_ci.patch
|
||||||
don_t_run_pcscan_notifythreadcreated_if_pcscan_is_disabled.patch
|
don_t_run_pcscan_notifythreadcreated_if_pcscan_is_disabled.patch
|
||||||
add_gin_wrappable_crash_key.patch
|
add_gin_wrappable_crash_key.patch
|
||||||
|
logging_win32_only_create_a_console_if_logging_to_stderr.patch
|
||||||
|
|
|
@ -0,0 +1,29 @@
|
||||||
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Jeremy Rose <jeremya@chromium.org>
|
||||||
|
Date: Mon, 2 Aug 2021 15:56:56 -0700
|
||||||
|
Subject: only create a console if logging to stderr
|
||||||
|
|
||||||
|
This fixes an issue on Windows where, when `--enable-logging=file` is
|
||||||
|
passed and the app was not run from the console, a console window would
|
||||||
|
be created for each child process, despite logs being redirected to a
|
||||||
|
file.
|
||||||
|
|
||||||
|
diff --git a/content/app/content_main.cc b/content/app/content_main.cc
|
||||||
|
index a26c5c2e053eddb4c70afb166a4643f38eb3c7f6..265b9af981454ab09ed34542ca845fb566b4a75d 100644
|
||||||
|
--- a/content/app/content_main.cc
|
||||||
|
+++ b/content/app/content_main.cc
|
||||||
|
@@ -370,8 +370,12 @@ RunContentProcess(const ContentMainParams& params,
|
||||||
|
|
||||||
|
#if defined(OS_WIN)
|
||||||
|
// Route stdio to parent console (if any) or create one.
|
||||||
|
- if (base::CommandLine::ForCurrentProcess()->HasSwitch(
|
||||||
|
- switches::kEnableLogging)) {
|
||||||
|
+ auto* cmd_line = base::CommandLine::ForCurrentProcess();
|
||||||
|
+ bool log_to_stderr =
|
||||||
|
+ cmd_line->HasSwitch(switches::kEnableLogging) &&
|
||||||
|
+ cmd_line->GetSwitchValueASCII(switches::kEnableLogging) != "file" &&
|
||||||
|
+ !cmd_line->HasSwitch(switches::kLogFile);
|
||||||
|
+ if (log_to_stderr) {
|
||||||
|
base::RouteStdioToConsole(true);
|
||||||
|
}
|
||||||
|
#endif
|
Loading…
Add table
Add a link
Reference in a new issue