diff --git a/src/filters/rclchm b/src/filters/rclchm index a60c6a07..4301293e 100755 --- a/src/filters/rclchm +++ b/src/filters/rclchm @@ -9,13 +9,13 @@ try: from chm import chm,chmlib except: print "RECFILTERROR HELPERNOTFOUND python:chm" - exit(1); + sys.exit(1); try: from HTMLParser import HTMLParser except: print "RECFILTERROR HELPERNOTFOUND python:HTMLParser" - exit(1); + sys.exit(1); class ChmTopicsParser(HTMLParser): """Parse the chm's Topic file which is basically diff --git a/src/filters/rclexecm.py b/src/filters/rclexecm.py index dca20b89..43518642 100644 --- a/src/filters/rclexecm.py +++ b/src/filters/rclexecm.py @@ -17,7 +17,7 @@ class RclExecM: def rclog(self, s, doexit = 0, exitvalue = 1): print >> sys.stderr, "RCLMFILT:", self.myname, ":", s if doexit: - exit(exitvalue) + sys.exit(exitvalue) # Our worker sometimes knows the mime types of the data it sends def setmimetype(self, mt): self.mimetype = mt diff --git a/src/filters/rclics b/src/filters/rclics index cbe80721..e0fee210 100755 --- a/src/filters/rclics +++ b/src/filters/rclics @@ -1,11 +1,13 @@ #!/usr/bin/env python import rclexecm +import sys + try: from icalendar import Calendar, Event except: print "RECFILTERROR HELPERNOTFOUND python:icalendar" - exit(1); + sys.exit(1); class IcalExtractor: def __init__(self, em): diff --git a/src/internfile/mh_execm.cpp b/src/internfile/mh_execm.cpp index 8d3f0f35..086c8d0b 100644 --- a/src/internfile/mh_execm.cpp +++ b/src/internfile/mh_execm.cpp @@ -60,6 +60,7 @@ bool MimeHandlerExecMultiple::startCmd() m_cmd.putenv(m_forPreview ? "RECOLL_FILTER_FORPREVIEW=yes" : "RECOLL_FILTER_FORPREVIEW=no"); if (m_cmd.startExec(cmd, myparams, 1, 1) < 0) { + m_reason = string("RECFILTERROR HELPERNOTFOUND ") + cmd; missingHelper = true; return false; } @@ -90,6 +91,15 @@ bool MimeHandlerExecMultiple::readDataElement(string& name, string &data) return true; } + // Filters will sometimes abort before entering the real protocol, ie if + // a module can't be loaded. Check the special filter error first word: + if (ibuf.find("RECFILTERROR ") == 0) { + m_reason = ibuf; + if (ibuf.find("HELPERNOTFOUND") != string::npos) + missingHelper = true; + return false; + } + // We're expecting something like Name: len\n list tokens; stringToTokens(ibuf, tokens); diff --git a/src/internfile/mh_execm.h b/src/internfile/mh_execm.h index dcf3b62a..352df812 100644 --- a/src/internfile/mh_execm.h +++ b/src/internfile/mh_execm.h @@ -68,14 +68,14 @@ class MimeHandlerExecMultiple : public MimeHandlerExec { {} // No resources to clean up, the ExecCmd destructor does it. virtual ~MimeHandlerExecMultiple() {} - virtual bool next_document(); - virtual void clear() { - MimeHandlerExec::clear(); - } virtual bool set_document_file(const string &file_path) { m_filefirst = true; return MimeHandlerExec::set_document_file(file_path); } + virtual bool next_document(); + + // skip_to and clear inherited from MimeHandlerExec + private: bool startCmd(); bool readDataElement(string& name, string& data);