diff --git a/chess/engine.py b/chess/engine.py index 60a4e4766..409a729ad 100644 --- a/chess/engine.py +++ b/chess/engine.py @@ -133,12 +133,7 @@ def __init__(self, engine, command, **kwargs): self._receiving_thread.start() def _receiving_thread_target(self): - while True: - line = self.process.stdout.readline() - if not line: - # Stream closed. - break - + for line in iter(self.process.stdout.readline, ""): self.engine.on_line_received(line.rstrip()) # Close file descriptors.