diff --git a/pyknp/utils/process.py b/pyknp/utils/process.py index 6e56b6a..f2c09ec 100644 --- a/pyknp/utils/process.py +++ b/pyknp/utils/process.py @@ -78,6 +78,8 @@ def alarm_handler(signum, frame): self.process.stdin.write(sentence.encode('utf-8')) self.process.stdin.flush() while True: + if self.process.poll() is not None: + break line = self.process.stdout.readline().decode('utf-8').rstrip() if re.search(pattern, line): break