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.
master
Romain Vimont 8 years ago
parent e8510a8cc3
commit e69f6f710d

@ -233,6 +233,12 @@ static SDL_bool parse_args(struct args *args, int argc, char *argv[]) {
} }
int main(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 = { struct args args = {
.serial = NULL, .serial = NULL,
.help = SDL_FALSE, .help = SDL_FALSE,

Loading…
Cancel
Save