Make as sure as we can that the forked child does not return and

continue the tests.
This commit is contained in:
Guido van Rossum 1997-01-17 16:13:15 +00:00
parent ed648a25bd
commit 1d1394e660

View file

@ -124,17 +124,20 @@ try:
conn.close() conn.close()
os._exit(0) os._exit(0)
else: else:
# child is client try:
time.sleep(1) # child is client
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) time.sleep(1)
if verbose: s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
print 'child connecting' if verbose:
s.connect(hostname, PORT) print 'child connecting'
msg = 'socket test' s.connect(hostname, PORT)
s.send(msg) msg = 'socket test'
data = s.recv(1024) s.send(msg)
if msg <> data: data = s.recv(1024)
print 'parent/client mismatch' if msg <> data:
s.close() print 'parent/client mismatch'
s.close()
finally:
os._exit(1)
except socket.error: except socket.error:
pass pass