prevent loop when none input

This commit is contained in:
Baptiste Fouques 2023-01-24 10:57:33 +01:00
parent 5dc2457a15
commit c0ce3b7bff
1 changed files with 5 additions and 3 deletions

View File

@ -1,7 +1,7 @@
#![allow(dead_code)]
/// Manage UCI messages and link into chess component
mod uci_command;
pub mod uci_command;
use log::{info, warn};
use std::io::*;
@ -63,8 +63,10 @@ impl<Fi: Read, Fo: Write> UciEngine<Fi, Fo> {
self.push(GuiCommand::Uci);
// Consume commands until uciok messages
while !self.uciok {
self.pull();
if self.source.is_some() {
while !self.uciok {
self.pull();
}
}
}