summaryrefslogtreecommitdiff
path: root/tools/c-index-test/c-index-test.c
diff options
context:
space:
mode:
Diffstat (limited to 'tools/c-index-test/c-index-test.c')
-rw-r--r--tools/c-index-test/c-index-test.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/tools/c-index-test/c-index-test.c b/tools/c-index-test/c-index-test.c
index 1d5cb1434c..576f3c4a58 100644
--- a/tools/c-index-test/c-index-test.c
+++ b/tools/c-index-test/c-index-test.c
@@ -4116,14 +4116,20 @@ typedef struct thread_info {
void thread_runner(void *client_data_v) {
thread_info *client_data = client_data_v;
client_data->result = cindextest_main(client_data->argc, client_data->argv);
-#ifdef __CYGWIN__
- fflush(stdout); /* stdout is not flushed on Cygwin. */
-#endif
+}
+
+static void flush_atexit(void) {
+ // stdout, and surprisingly even stderr, are not always flushed on process
+ // and thread exit, particularly when the system is under heavy load.
+ fflush(stdout);
+ fflush(stderr);
}
int main(int argc, const char **argv) {
thread_info client_data;
+ atexit(flush_atexit);
+
#ifdef CLANG_HAVE_LIBXML
LIBXML_TEST_VERSION
#endif