From d49c47bfb0ea3bc2e7d8778d8002c0f628d97488 Mon Sep 17 00:00:00 2001 From: Guido van Rossum Date: Sat, 19 Oct 2013 21:26:34 -0700 Subject: [PATCH] Break out of loop on EOF in asyncio echo test programs. --- Lib/test/test_asyncio/echo.py | 2 ++ Lib/test/test_asyncio/echo3.py | 2 ++ 2 files changed, 4 insertions(+) diff --git a/Lib/test/test_asyncio/echo.py b/Lib/test/test_asyncio/echo.py index f6ac0a30d34..006364bb007 100644 --- a/Lib/test/test_asyncio/echo.py +++ b/Lib/test/test_asyncio/echo.py @@ -3,4 +3,6 @@ if __name__ == '__main__': while True: buf = os.read(0, 1024) + if not buf: + break os.write(1, buf) diff --git a/Lib/test/test_asyncio/echo3.py b/Lib/test/test_asyncio/echo3.py index f1f7ea7c9e2..064496736bf 100644 --- a/Lib/test/test_asyncio/echo3.py +++ b/Lib/test/test_asyncio/echo3.py @@ -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: