summaryrefslogtreecommitdiff
path: root/Userland/Games
diff options
context:
space:
mode:
Diffstat (limited to 'Userland/Games')
-rw-r--r--Userland/Games/Chess/Engine.cpp8
-rw-r--r--Userland/Games/Chess/Engine.h3
2 files changed, 8 insertions, 3 deletions
diff --git a/Userland/Games/Chess/Engine.cpp b/Userland/Games/Chess/Engine.cpp
index a28b5fc13c..cbfcf40d1d 100644
--- a/Userland/Games/Chess/Engine.cpp
+++ b/Userland/Games/Chess/Engine.cpp
@@ -13,8 +13,7 @@
Engine::~Engine()
{
- if (m_pid != -1)
- kill(m_pid, SIGINT);
+ quit();
}
Engine::Engine(StringView command)
@@ -66,3 +65,8 @@ void Engine::handle_bestmove(Chess::UCI::BestMoveCommand const& command)
m_bestmove_callback = nullptr;
}
+
+void Engine::quit()
+{
+ send_command(Chess::UCI::QuitCommand());
+}
diff --git a/Userland/Games/Chess/Engine.h b/Userland/Games/Chess/Engine.h
index d91127714b..dd5906cf84 100644
--- a/Userland/Games/Chess/Engine.h
+++ b/Userland/Games/Chess/Engine.h
@@ -33,6 +33,7 @@ public:
}
private:
+ void quit();
+
Function<void(Chess::Move)> m_bestmove_callback;
- pid_t m_pid { -1 };
};