Force stdout and standerr on Windows to unbuffered mode.

Normally stdout and stderr are buffered. In case of a crash the last
lines aren't written to the stdout.txt, making post mortem debugging
difficult. Forcing both FDs to unbuffered mode ensures that everything
gets written. The performance impact is negliable.
This commit is contained in:
Yamagi 2020-10-06 17:22:50 +02:00
parent 741ffcdb1c
commit dfaf33e478

3
src/backends/windows/system.c Normal file → Executable file
View file

@ -717,6 +717,9 @@ Sys_RedirectStdout(void)
_wfreopen(wpath_stdout, L"w", stdout);
_wfreopen(wpath_stderr, L"w", stderr);
setvbuf(stdout, (char *)NULL, _IOLBF, BUFSIZ);
setvbuf(stderr, (char *)NULL, _IOLBF, BUFSIZ);
}
/* ======================================================================= */