]> granicus.if.org Git - python/commitdiff
Make as sure as we can that the forked child does not return and
authorGuido van Rossum <guido@python.org>
Fri, 17 Jan 1997 16:13:15 +0000 (16:13 +0000)
committerGuido van Rossum <guido@python.org>
Fri, 17 Jan 1997 16:13:15 +0000 (16:13 +0000)
continue the tests.

Lib/test/test_socket.py

index f7b62a9bbcd875e20e2a3bfdfc3f25dc4ba0f178..c27e69f4ef75f9cf8734af95dd8173d0b92402b2 100644 (file)
@@ -124,17 +124,20 @@ try:
        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