Skip to content

Commit 3afccea

Browse files
committed
flush output in print model
1 parent c116562 commit 3afccea

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed

lib/c-api/src/main.cc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,9 @@ class ClingoApp : public Clasp::Cli::ClaspAppBase {
210210
auto prt = [&]() { out.printModelValues(ctx, mdl); };
211211
// NOTE: the function can only be called while the solve handle is alive
212212
auto guard = CppClingo::Control::unlock_guard{ctl_->slv->get_lock()};
213+
std::cout.flush();
213214
app_.print_model(ctl_->slv->map_model(mdl), prt);
215+
std::cout.flush();
214216
});
215217
return output;
216218
}

lib/python-api/src/app.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,7 @@ class App : public reference_keeper<App> {
139139
auto &app = *static_cast<App *>(data);
140140
CLINGO_TRY {
141141
app.print_model(Model{model}, [printer, printer_data]() { handle_error(printer(printer_data)); });
142+
py::module_::import("sys").attr("stdout").attr("flush")();
142143
}
143144
CLINGO_CATCH;
144145
}

0 commit comments

Comments
 (0)