[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.
This commit is contained in:
Ray Speth 2015-12-10 18:18:26 -05:00
parent 1c09f7f14b
commit 0703770638

View file

@ -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) {