diff --git a/src/internfile/mh_exec.cpp b/src/internfile/mh_exec.cpp index 44678039..17cc973b 100644 --- a/src/internfile/mh_exec.cpp +++ b/src/internfile/mh_exec.cpp @@ -60,7 +60,7 @@ void MEAdv::newData(int n) time(0L) - m_start > m_filtermaxseconds) { LOGERR(("MimeHandlerExec: filter timeout (%d S)\n", m_filtermaxseconds)); - CancelCheck::instance().setCancel(); + throw HandlerTimeout(); } // If a cancel request was set by the signal handler (or by us // just above), this will raise an exception. Another approach @@ -117,6 +117,9 @@ bool MimeHandlerExec::next_document() int status; try { status = mexec.doexec(cmd, myparams, 0, &output); + } catch (HandlerTimeout) { + LOGERR(("MimeHandlerExec: handler timeout\n")); + status = 0x110f; } catch (CancelExcept) { LOGERR(("MimeHandlerExec: cancelled\n")); status = 0x110f; diff --git a/src/internfile/mh_exec.h b/src/internfile/mh_exec.h index 1bda51d3..15e359b4 100644 --- a/src/internfile/mh_exec.h +++ b/src/internfile/mh_exec.h @@ -23,6 +23,8 @@ #include "mimehandler.h" #include "execmd.h" +class HandlerTimeout {}; + /** * Turn external document into internal one by executing an external filter. * diff --git a/src/internfile/mh_execm.cpp b/src/internfile/mh_execm.cpp index 3b383939..05ecdce0 100644 --- a/src/internfile/mh_execm.cpp +++ b/src/internfile/mh_execm.cpp @@ -228,8 +228,12 @@ bool MimeHandlerExecMultiple::next_document() m_cmd.zapChild(); return false; } + } catch (HandlerTimeout) { + LOGINFO(("MHExecMultiple: timeout\n")); + m_cmd.zapChild(); + return false; } catch (CancelExcept) { - LOGINFO(("MHExecMultiple: timeout or interrupt\n")); + LOGINFO(("MHExecMultiple: interrupt\n")); m_cmd.zapChild(); return false; }