Disable stdout/stderr buffering on Windows

In MSYS2 on Windows, the output is buffered by default. Disable
buffering to print output immediately.

Note that in cmd.exe, it still prints nothing.
This commit is contained in:
Romain Vimont 2018-03-13 10:20:09 +01:00
parent e8510a8cc3
commit e69f6f710d

View file

@ -233,6 +233,12 @@ static SDL_bool parse_args(struct args *args, int argc, char *argv[]) {
}
int main(int argc, char *argv[]) {
#ifdef __WINDOWS__
// disable buffering, we want logs immediately
// even line buffering (setvbuf() with mode _IOLBF) is not sufficient
setbuf(stdout, NULL);
setbuf(stderr, NULL);
#endif
struct args args = {
.serial = NULL,
.help = SDL_FALSE,