Skip to content

Commit 5e81337

Browse files
committed
Python 2.7 issue
1 parent f42e75c commit 5e81337

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

‎language_tool/__init__.py‎

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -338,15 +338,21 @@ def _start_server(cls):
338338
universal_newlines=True,
339339
startupinfo=startupinfo
340340
)
341-
for line in cls._server.stdout:
341+
# Python 2.7 compatibility
342+
#for line in cls._server.stdout:
343+
match = None
344+
while True:
345+
line = cls._server.stdout.readline()
346+
if not line:
347+
break
342348
match = cls._PORT_RE.search(line)
343349
if match:
344350
port = int(match.group(1))
345351
if port != cls._port:
346352
raise Error("requested port {}, but got {}"
347353
.format(cls._port, port))
348354
break
349-
else:
355+
if not match:
350356
cls._terminate_server()
351357
err_msg = cls._server.communicate()[1].strip()
352358
cls._server = None

0 commit comments

Comments
 (0)