Fix end of stream detecting

This commit is contained in:
Paweł Kierski
2019-02-20 16:41:44 +01:00
parent 48e54a8460
commit 1614fd6eb2
2 changed files with 7 additions and 5 deletions

View File

@@ -64,10 +64,12 @@ class Server():
async def run(self):
while self._active:
data = await self._reader.readline()
if not data:
# on windows rederecting a pipe to stdin result on continues
# not-blocking return of empty line on EOF
try:
data = await self._reader.readline()
if not data:
self._eof()
continue
except:
self._eof()
continue
data = data.strip()