Skip to content

Commit b68812f

Browse files
Disable output buffering for console
1 parent 697be19 commit b68812f

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

ffrunner.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -665,13 +665,16 @@ fetch_icon(char *iconUrl, char *outPath)
665665
}
666666

667667
void
668-
parent_console_redirect() {
668+
setup_console() {
669669
if (AttachConsole(ATTACH_PARENT_PROCESS)) {
670670
// reopen C stdio to the attached console
671671
FILE* f;
672672
freopen_s(&f, "CONIN$", "r", stdin);
673673
freopen_s(&f, "CONOUT$", "w", stdout);
674674
freopen_s(&f, "CONOUT$", "w", stderr);
675+
676+
// disable output buffering
677+
setvbuf(stdout, NULL, _IONBF, 0);
675678
}
676679
}
677680

@@ -686,7 +689,7 @@ main(int argc, char **argv)
686689
RECT winRect;
687690
char iconFile[MAX_PATH];
688691

689-
parent_console_redirect();
692+
setup_console();
690693
parse_args(argc, argv);
691694
print_args();
692695
init_logging(args.logPath, args.verboseLogging);

0 commit comments

Comments
 (0)