[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:
parent
1c09f7f14b
commit
0703770638
1 changed files with 2 additions and 0 deletions
|
|
@ -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) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue