mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 21:27:45 +00:00
Chess+ChessEngine: Fix stockfish by setting correct blocking flag
Stockfish apparently cannot handle non-blocking I/O, and it does not make sense to assume that all chess engines can do so. Fixes #18946.
This commit is contained in:
parent
62ebb78433
commit
bdeccf8844
2 changed files with 10 additions and 3 deletions
|
@ -16,7 +16,11 @@ ErrorOr<int> serenity_main(Main::Arguments)
|
|||
Core::EventLoop loop;
|
||||
TRY(Core::System::unveil(nullptr, nullptr));
|
||||
|
||||
auto engine = TRY(ChessEngine::try_create(TRY(Core::File::standard_input()), TRY(Core::File::standard_output())));
|
||||
auto infile = TRY(Core::File::standard_input());
|
||||
TRY(infile->set_blocking(false));
|
||||
auto outfile = TRY(Core::File::standard_output());
|
||||
TRY(outfile->set_blocking(false));
|
||||
auto engine = TRY(ChessEngine::try_create(move(infile), move(outfile)));
|
||||
engine->on_quit = [&](auto status_code) {
|
||||
loop.quit(status_code);
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue