summaryrefslogtreecommitdiff
path: root/Userland/Services
diff options
context:
space:
mode:
authorBen Wiederhake <BenWiederhake.GitHub@gmx.de>2023-05-21 22:27:01 +0200
committerAndreas Kling <kling@serenityos.org>2023-05-27 18:44:21 +0200
commitbdeccf8844b9d6cc382f27c0f0f1481c5c3b5186 (patch)
tree8364744742227bc01136b978dd2678ba99d83534 /Userland/Services
parent62ebb78433e9aec7a8d5d69a4900e4b90f8e4dc2 (diff)
downloadserenity-bdeccf8844b9d6cc382f27c0f0f1481c5c3b5186.zip
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.
Diffstat (limited to 'Userland/Services')
-rw-r--r--Userland/Services/ChessEngine/main.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/Userland/Services/ChessEngine/main.cpp b/Userland/Services/ChessEngine/main.cpp
index 81975d2feb..c12fce6efd 100644
--- a/Userland/Services/ChessEngine/main.cpp
+++ b/Userland/Services/ChessEngine/main.cpp
@@ -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);
};