[Base] Attach console on cvar help/failure.

[Base] Attempt attaching to console on cvar help/failure.
This commit is contained in:
gibbed
2021-06-28 11:27:36 -05:00
committed by Rick Gibbed
parent 80cafd9358
commit 92242f3f7d
4 changed files with 9 additions and 5 deletions

View File

@@ -50,10 +50,6 @@ bool has_shell_environment_variable() {
}
void AttachConsole() {
if (!cvars::enable_console) {
return;
}
bool has_console = ::AttachConsole(ATTACH_PARENT_PROCESS) == TRUE;
if (!has_console || !has_shell_environment_variable()) {
// We weren't launched from a console, so just return.
@@ -145,7 +141,9 @@ int Main() {
// Attach a console so we can write output to stdout. If the user hasn't
// redirected output themselves it'll pop up a window.
xe::AttachConsole();
if (cvars::enable_console) {
xe::AttachConsole();
}
// Setup COM on the main thread.
// NOTE: this may fail if COM has already been initialized - that's OK.