Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 1 commit into from
Apr 12, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions common-main.c
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,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
Expand Down