tool and tests: force flush of all buffers at end of program

On Windows data can be lost in buffers in case of abnormal program
termination, especially in process chains as seen due to flaky tests.
Therefore flushing all buffers manually should avoid this data loss.

In the curl tool we play the safe game by only flushing write buffers,
but in the testsuite where we manage all buffers, we flush everything.

This should drastically reduce Windows CI and testsuite flakiness.

Reviewed-by: Daniel Stenberg

Supersedes #7833 and #6064
Closes #8516
This commit is contained in:
Marc Hoersken 2022-02-26 14:34:42 +01:00
parent 3b4a353025
commit 8b42d7b9d4
No known key found for this signature in database
GPG key ID: AD50A64F2A32040F
4 changed files with 20 additions and 5 deletions

View file

@ -277,6 +277,11 @@ int main(int argc, char *argv[])
main_free(&global);
}
#ifdef WIN32
/* Flush buffers of all streams opened in write or update mode */
fflush(NULL);
#endif
#ifdef __NOVELL_LIBC__
if(!getenv("_IN_NETWARE_BASH_"))
tool_pressanykey();