The chess GUI now instructs the ChessEngine to gracefully exit by sending a UCI quit command.
@@ -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());
+}
@@ -33,6 +33,7 @@ public:
private:
+ void quit();
Function<void(Chess::Move)> m_bestmove_callback;
- pid_t m_pid { -1 };
};