Skip to content
This repository was archived by the owner on Sep 10, 2022. It is now read-only.

Commit 610cfc3

Browse files
committed
Fix console output for Windows.
1 parent 4faa43e commit 610cfc3

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/win/main.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,11 @@ int APIENTRY _tWinMain(_In_ HINSTANCE hInstance,
158158
_CrtSetReportHook(CrtDbgHook);
159159
SetErrorMode(SEM_FAILCRITICALERRORS | SEM_NOGPFAULTERRORBOX |
160160
SEM_NOOPENFILEERRORBOX);
161+
// Make stderr/stdout work from a non-console app.
162+
if (AttachConsole(ATTACH_PARENT_PROCESS)) {
163+
freopen("CONOUT$", "wb", stdout);
164+
freopen("CONOUT$", "wb", stderr);
165+
}
161166

162167
// The Visual Studio debugger starts us in the build\ subdirectory by
163168
// default, which will prevent us from finding the test files in the html\

0 commit comments

Comments
 (0)