]> granicus.if.org Git - python/commitdiff
Break out of loop on EOF in asyncio echo test programs.
authorGuido van Rossum <guido@dropbox.com>
Sun, 20 Oct 2013 04:26:34 +0000 (21:26 -0700)
committerGuido van Rossum <guido@dropbox.com>
Sun, 20 Oct 2013 04:26:34 +0000 (21:26 -0700)
Lib/test/test_asyncio/echo.py
Lib/test/test_asyncio/echo3.py

index f6ac0a30d341cb3a6b1671c12f68d2d07b6bce5d..006364bb007b0f1284e879a9020d7e5e3c134b43 100644 (file)
@@ -3,4 +3,6 @@ import os
 if __name__ == '__main__':
     while True:
         buf = os.read(0, 1024)
+        if not buf:
+            break
         os.write(1, buf)
index f1f7ea7c9e21eddb86b75345cd0e109c32557152..064496736bf3f474ef6f0d582294180ec9d1dc52 100644 (file)
@@ -3,6 +3,8 @@ import os
 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: