Break out of loop on EOF in asyncio echo test programs.

This commit is contained in:
Guido van Rossum 2013-10-19 21:26:34 -07:00
parent 0acceb7697
commit d49c47bfb0
2 changed files with 4 additions and 0 deletions

View File

@ -3,4 +3,6 @@
if __name__ == '__main__':
while True:
buf = os.read(0, 1024)
if not buf:
break
os.write(1, buf)

View File

@ -3,6 +3,8 @@
if __name__ == '__main__':
while True:
buf = os.read(0, 1024)
if not buf:
break
try:
os.write(1, b'OUT:'+buf)
except OSError as ex: