Skip to content

Commit

Permalink
std::fflush() #220
Browse files Browse the repository at this point in the history
Need to flush console output for AMPL IDE and SW console
  • Loading branch information
Gleb Belov committed Aug 18, 2023
1 parent 99f1015 commit ece4a6f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions include/mp/solver-app.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ class SolverApp : private Reader {
void HandleOutput(fmt::CStringRef output) {
has_output = true;
std::fputs(output.c_str(), stdout);
std::fflush(stdout); // #220
}
};
AppOutputHandler output_handler_;
Expand Down
2 changes: 2 additions & 0 deletions include/mp/solver-base.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ class OutputHandler {
virtual void HandleOutput(fmt::CStringRef output) {
has_output = true;
std::fputs(output.c_str(), stdout);
std::fflush(stdout); // #220
}
};

Expand Down Expand Up @@ -284,6 +285,7 @@ class BasicSolver : private ErrorHandler,
/// Override methods from base service classes
void HandleOutput(fmt::CStringRef output) override {
std::fputs(output.c_str(), stdout);
std::fflush(stdout); // #220
}

/// Handle error
Expand Down

0 comments on commit ece4a6f

Please sign in to comment.