Ed Blackman wrote:
> Shouldn't we have a try block around the appropriate lines in
> FilterParser, to catch IOError and perhaps others, so that failures at
> least print the line that has the problem in the debug log?
I went ahead and did this: patch attached. Now the debug log line is
the much more reasonable and informative:
MatchError: [line 52]: command "spamCheckDNSBL" aborted with IOError Broken pipe
Ed
--- /usr/lib/python2.3/site-packages/TMDA/FilterParser.py.orig 2004-08-20
15:12:16.000000000 -0400
+++ /usr/lib/python2.3/site-packages/TMDA/FilterParser.py 2004-08-20
15:56:14.000000000 -0400
@@ -1034,16 +1034,22 @@
# A match is found if the command exits with a zero exit
# status.
if source == 'pipe' and msg_body and msg_headers:
- cmd = popen2.Popen3(match, 1, bufsize=-1)
- cmdout, cmdin, cmderr = cmd.fromchild, cmd.tochild, cmd.childerr
- cmdin.write(msg_headers + '\n' + msg_body)
- cmdin.flush()
- cmdin.close()
- err = cmderr.read().strip()
- cmderr.close()
- out = cmdout.read().strip()
- cmdout.close()
- r = cmd.wait()
+ r = 0
+ try:
+ cmd = popen2.Popen3(match, 1, bufsize=-1)
+ cmdout, cmdin, cmderr = cmd.fromchild, cmd.tochild, cmd.childerr
+ cmdin.write(msg_headers + '\n' + msg_body)
+ cmdin.flush()
+ cmdin.close()
+ err = cmderr.read().strip()
+ cmderr.close()
+ out = cmdout.read().strip()
+ cmdout.close()
+ r = cmd.wait()
+ except IOError, ex:
+ raise MatchError(lineno,
+ 'command "%s" aborted with IOError %s' \
+ % (match, ex.strerror))
if r == 0:
found_match = 1
break
_________________________________________________
tmda-workers mailing list ([EMAIL PROTECTED])
http://tmda.net/lists/listinfo/tmda-workers