Fix info args not working with -console

The intention of the `-console` argument was to enable seeing console
output on Windows without having to use workarounds. However, this
didn't actually work for arguments like `-addresses` and `-version`,
because the program would exit first before it could get the chance to
create the console.

The other issue is that the console closes too quickly before output can
be read by the user. So to fix that, we must hold it open and let the
user close it when they want to by waiting for an enter press from
STDIN.
This commit is contained in:
Misa
2024-06-02 11:09:22 -07:00
committed by Misa Elizabeth Kai
parent a9d43b543f
commit dd15d67e62
2 changed files with 80 additions and 32 deletions

View File

@@ -220,6 +220,12 @@ void vlog_open_console(void)
vlog_error("Could not redirect STDERR to console.");
}
handle = freopen("CON", "r", stdin);
if (handle == NULL)
{
vlog_error("Could not redirect STDIN to console.");
}
check_color_support();
if (!SetConsoleOutputCP(CP_UTF8))