common-main.c: fflush stdout buffer when exit (#4901)

This commit is contained in:
Johannes Schindelin 2024-04-12 14:22:30 +02:00
commit e2aa8b7aa2

View File

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