[Checkins] SVN: zc.FileStorage/dev/src/zc/FileStorage/__init__.py
Pickle exceptions in the subprocess so they can be reraised in the
Jim Fulton
jim at zope.com
Wed Dec 12 16:42:14 EST 2007
Log message for revision 82267:
Pickle exceptions in the subprocess so they can be reraised in the
parent process.
Changed:
U zc.FileStorage/dev/src/zc/FileStorage/__init__.py
-=-
Modified: zc.FileStorage/dev/src/zc/FileStorage/__init__.py
===================================================================
--- zc.FileStorage/dev/src/zc/FileStorage/__init__.py 2007-12-12 21:14:12 UTC (rev 82266)
+++ zc.FileStorage/dev/src/zc/FileStorage/__init__.py 2007-12-12 21:42:14 UTC (rev 82267)
@@ -84,6 +84,11 @@
proc.stdin.close()
out = proc.stdout.read()
if proc.wait():
+ if os.path.exists(self._name+'.packerror'):
+ v = cPickle.Unpickler(open(self._name+'.packerror', 'rb')
+ ).load()
+ os.remove(self._name+'.packerror')
+ raise v
raise RuntimeError('The Pack subprocess failed\n'
+'-'*60+out+'-'*60+'\n')
@@ -241,10 +246,20 @@
sys.path[:] = %(syspath)r
+import cPickle
import zc.FileStorage
-packer = zc.FileStorage.PackProcess(%(path)r, %(stop)r, %(size)r)
-packer.pack()
+try:
+ packer = zc.FileStorage.PackProcess(%(path)r, %(stop)r, %(size)r)
+ packer.pack()
+except Exception, v:
+ try:
+ v = cPickle.dumps(v)
+ except Exception:
+ pass
+ else:
+ open(%(path)r+'.packerror', 'w').write(v)
+ raise
"""
class PackProcess(FileStoragePacker):
More information about the Checkins
mailing list