Skip to content

Commit 12bc2c6

Browse files
chengzhuo5dscho
authored andcommitted
common-main.c: fflush stdout buffer upon exit
By default, the buffer type of Windows' `stdout` is unbuffered (_IONBF), and there is no need to manually fflush `stdout`. But some programs, such as the Windows Filtering Platform driver provided by the security software, may change the buffer type of `stdout` to full buffering. This nees `fflush(stdout)` to be called manually, otherwise there will be no output to `stdout`. Signed-off-by: MinarKotonoha <chengzhuo5@qq.com> Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
1 parent c6ca5c1 commit 12bc2c6

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

Diff for: common-main.c

+7
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,13 @@ static void check_bug_if_BUG(void)
7777
/* We wrap exit() to call common_exit() in git-compat-util.h */
7878
int common_exit(const char *file, int line, int code)
7979
{
80+
/*
81+
* Windows Filtering Platform driver provided by the security software
82+
* may change buffer type of stdout from _IONBF to _IOFBF.
83+
* It will no output without fflush manually.
84+
*/
85+
fflush(stdout);
86+
8087
/*
8188
* For non-POSIX systems: Take the lowest 8 bits of the "code"
8289
* to e.g. turn -1 into 255. On a POSIX system this is

0 commit comments

Comments
 (0)