From 0703770638bc8ba1a029af982105ca72db91b28c Mon Sep 17 00:00:00 2001 From: Ray Speth Date: Thu, 10 Dec 2015 18:18:26 -0500 Subject: [PATCH] [Python] Regularly flush stdout when printing from C++ This prevents excessive output buffering when output is being redirected and the only source of printing is Cantera's c++ functions, e.g. when running the 1D solver. --- include/cantera/cython/wrappers.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/cantera/cython/wrappers.h b/include/cantera/cython/wrappers.h index 0b50207d3..d6d44ea09 100644 --- a/include/cantera/cython/wrappers.h +++ b/include/cantera/cython/wrappers.h @@ -25,10 +25,12 @@ public: for (size_t i = 0; i < s.size(); i+=N) { PySys_WriteStdout("%s", s.substr(i, N).c_str()); } + std::cout.flush(); } virtual void writeendl() { PySys_WriteStdout("%s", "\n"); + std::cout.flush(); } virtual void error(const std::string& msg) {