Skip to content

Commit

Permalink
Simplify read stdout until end
Browse files Browse the repository at this point in the history
  • Loading branch information
niklasf committed Sep 28, 2018
1 parent 91ca83d commit 509f3e2
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions chess/engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 509f3e2

Please sign in to comment.