Ensure that the missing helper is listed in the log for all affected documents
This commit is contained in:
parent
369147e62e
commit
d3d27dcd21
@ -20,8 +20,6 @@
|
||||
#include <time.h>
|
||||
#include "safesyswait.h"
|
||||
|
||||
#include <list>
|
||||
|
||||
#include "cstr.h"
|
||||
#include "execmd.h"
|
||||
#include "mh_exec.h"
|
||||
@ -131,6 +129,7 @@ bool MimeHandlerExec::next_document()
|
||||
m_havedoc = false;
|
||||
if (missingHelper) {
|
||||
LOGDEB("MimeHandlerExec::next_document(): helper known missing\n");
|
||||
m_reason = whatHelper;
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -186,21 +185,18 @@ bool MimeHandlerExec::next_document()
|
||||
// missing cmd.
|
||||
missingHelper = true;
|
||||
m_reason = string("RECFILTERROR HELPERNOTFOUND ") + cmd;
|
||||
whatHelper = m_reason;
|
||||
} else if (output.find("RECFILTERROR") == 0) {
|
||||
// If the output string begins with RECFILTERROR, then it's
|
||||
// interpretable error information out from a recoll script
|
||||
m_reason = output;
|
||||
list<string> lerr;
|
||||
stringToStrings(output, lerr);
|
||||
if (lerr.size() > 2) {
|
||||
list<string>::iterator it = lerr.begin();
|
||||
it++;
|
||||
if (*it == "HELPERNOTFOUND") {
|
||||
// No use trying again and again to execute this filter,
|
||||
// it won't work.
|
||||
std::string::size_type pos;
|
||||
if ((pos = output.find("RECFILTERROR ")) == 0) {
|
||||
if (output.find("HELPERNOTFOUND") != string::npos) {
|
||||
missingHelper = true;
|
||||
whatHelper = output.substr(pos);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -63,6 +63,7 @@ public:
|
||||
// line option.
|
||||
std::string cfgFilterOutputCharset;
|
||||
bool missingHelper{false};
|
||||
std::string whatHelper;
|
||||
// Resource management values
|
||||
|
||||
// The filtermaxseconds default is set in the constructor by
|
||||
|
||||
@ -17,10 +17,10 @@
|
||||
#include "autoconfig.h"
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include <sys/types.h>
|
||||
#include "safesyswait.h"
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
using namespace std;
|
||||
|
||||
#include "cstr.h"
|
||||
#include "mh_execm.h"
|
||||
@ -34,8 +34,7 @@ using namespace std;
|
||||
#include "idfile.h"
|
||||
#include "rclutil.h"
|
||||
|
||||
#include <sys/types.h>
|
||||
#include "safesyswait.h"
|
||||
using namespace std;
|
||||
|
||||
bool MimeHandlerExecMultiple::startCmd()
|
||||
{
|
||||
@ -75,6 +74,7 @@ bool MimeHandlerExecMultiple::startCmd()
|
||||
if (m_cmd.startExec(cmd, myparams, 1, 1) < 0) {
|
||||
m_reason = string("RECFILTERROR HELPERNOTFOUND ") + cmd;
|
||||
missingHelper = true;
|
||||
whatHelper = cmd;
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
@ -109,10 +109,13 @@ bool MimeHandlerExecMultiple::readDataElement(string& name, string &data)
|
||||
|
||||
// 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) {
|
||||
std::string::size_type pos;
|
||||
if ((pos = ibuf.find("RECFILTERROR ")) == 0) {
|
||||
m_reason = ibuf;
|
||||
if (ibuf.find("HELPERNOTFOUND") != string::npos)
|
||||
if (ibuf.find("HELPERNOTFOUND") != string::npos) {
|
||||
missingHelper = true;
|
||||
whatHelper = ibuf.substr(pos);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -168,6 +171,7 @@ bool MimeHandlerExecMultiple::next_document()
|
||||
|
||||
if (missingHelper) {
|
||||
LOGDEB("MHExecMultiple::next_document(): helper known missing\n");
|
||||
m_reason = whatHelper;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user