This exit wrapper works around an issue where processes running under MinGW can
exit with unbuffered data remaining in their stdout and stderr internal buffers
without being flushed. The C stdio and C++ iostreams implementations can have
separate buffers. Thus when using this wrapper in C++ code in combination with
C++ iostreams (e.g. cmd/mingle/minglemain.cpp) we need to additionally flush the
C++ buffers as well.
Gitlab: #2178
#include <stdlib.h>
#ifdef __cplusplus
+#include <iostream>
+
extern "C" {
#endif
// workaround for https://gitlab.com/graphviz/graphviz/-/issues/2178
fflush(stdout);
fflush(stderr);
+#ifdef __cplusplus
+ std::cout.flush();
+ std::cerr.flush();
+#endif
#endif
exit(status);
}