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