Mercurial > cpython-lru_cache-weakref
diff Lib/test/test_socket.py @ 4986:d8d563baf874 legacy-trunk
Make as sure as we can that the forked child does not return and
continue the tests.
| author | Guido van Rossum <guido@python.org> |
|---|---|
| date | Fri, 17 Jan 1997 16:13:15 +0000 |
| parents | 5eed51750284 |
| children | 5a232870ccea |
line wrap: on
line diff
--- a/Lib/test/test_socket.py Fri Jan 17 16:08:55 1997 +0000 +++ b/Lib/test/test_socket.py Fri Jan 17 16:13:15 1997 +0000 @@ -124,17 +124,20 @@ conn.close() os._exit(0) else: - # child is client - time.sleep(1) - s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) - if verbose: - print 'child connecting' - s.connect(hostname, PORT) - msg = 'socket test' - s.send(msg) - data = s.recv(1024) - if msg <> data: - print 'parent/client mismatch' - s.close() + try: + # child is client + time.sleep(1) + s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) + if verbose: + print 'child connecting' + s.connect(hostname, PORT) + msg = 'socket test' + s.send(msg) + data = s.recv(1024) + if msg <> data: + print 'parent/client mismatch' + s.close() + finally: + os._exit(1) except socket.error: pass
