[Zodb-checkins] CVS: StandaloneZODB/ZEO/tests - forker.py:1.1.2.6
Jeremy Hylton
jeremy@zope.com
Thu, 3 Jan 2002 19:14:18 -0500
Update of /cvs-repository/StandaloneZODB/ZEO/tests
In directory cvs.zope.org:/tmp/cvs-serv22512/tests
Modified Files:
Tag: ZEO-ZRPC-Dev
forker.py
Log Message:
Ignore os.error when attempting to shutdown a failed StorageServer.
Print a nicer error message when a StorageServer fails unexpectedly.
Don't let the exception get back to unittest, because the fork()
confuses test runnner and it will continue trying to run tests.
=== StandaloneZODB/ZEO/tests/forker.py 1.1.2.5 => 1.1.2.6 ===
import socket
import sys
+import traceback
import types
import ZEO.ClientStorage, ZEO.StorageServer
@@ -86,20 +87,27 @@
self.pipe = pipe
def close(self):
- os.write(self.pipe, "done")
- os.close(self.pipe)
+ try:
+ os.write(self.pipe, "done")
+ os.close(self.pipe)
+ except os.error:
+ pass
def start_zeo_server(storage, addr):
rd, wr = os.pipe()
pid = os.fork()
if pid == 0:
- if PROFILE:
- p = profile.Profile()
- p.runctx("run_server(storage, addr, rd, wr)", globals(),
- locals())
- p.dump_stats("stats.s.%d" % os.getpid())
- else:
- run_server(storage, addr, rd, wr)
+ try:
+ if PROFILE:
+ p = profile.Profile()
+ p.runctx("run_server(storage, addr, rd, wr)", globals(),
+ locals())
+ p.dump_stats("stats.s.%d" % os.getpid())
+ else:
+ run_server(storage, addr, rd, wr)
+ except:
+ print "Exception in ZEO server process"
+ traceback.print_exc()
os._exit(0)
else:
os.close(rd)