Properly check return values so TIMEOUT is recognized.

This commit is contained in:
Richard Kimberly Heck 2020-05-17 14:57:55 -04:00
parent 49098aa318
commit c6b3f35c8c
3 changed files with 22 additions and 21 deletions

View File

@ -595,8 +595,8 @@ Converters::RetVal Converters::convert(Buffer const * buffer,
// FIXME KILLED
// Check changed return value here.
RetVal const retval = runLaTeX(*buffer, command, runparams, errorList);
if (retval != SUCCESS)
return retval;
if (retval != SUCCESS)
return retval;
} else {
if (conv.need_aux() && !run_latex) {
// We are not importing, we have a buffer
@ -866,7 +866,7 @@ Converters::RetVal Converters::runLaTeX(Buffer const & buffer, string const & co
});
int const result = latex.run(terr);
if (result == Systemcall::KILLED) {
if (result == Systemcall::KILLED || result == Systemcall::TIMEOUT) {
Alert::error(_("Export canceled"),
_("The export process was terminated by the user."));
return KILLED;

View File

@ -281,16 +281,16 @@ int LaTeX::run(TeXErrors & terr)
message(runMessage(count));
int exit_code = startscript();
if (exit_code == Systemcall::KILLED)
return Systemcall::KILLED;
if (exit_code == Systemcall::KILLED || exit_code == Systemcall::TIMEOUT)
return exit_code;
scanres = scanLogFile(terr);
if (scanres & ERROR_RERUN) {
LYXERR(Debug::LATEX, "Rerunning LaTeX");
terr.clearErrors();
exit_code = startscript();
if (exit_code == Systemcall::KILLED)
return Systemcall::KILLED;
if (exit_code == Systemcall::KILLED || exit_code == Systemcall::TIMEOUT)
return exit_code;
scanres = scanLogFile(terr);
}
@ -322,8 +322,8 @@ int LaTeX::run(TeXErrors & terr)
// onlyFileName() is needed for cygwin
int const ret =
runMakeIndex(onlyFileName(idxfile.absFileName()), runparams);
if (ret == Systemcall::KILLED)
return Systemcall::KILLED;
if (ret == Systemcall::KILLED || ret == Systemcall::TIMEOUT)
return ret;
FileName const ilgfile(changeExtension(file.absFileName(), ".ilg"));
if (ilgfile.exists())
iscanres = scanIlgFile(terr);
@ -338,8 +338,8 @@ int LaTeX::run(TeXErrors & terr)
// FIXME: Sort out the real problem in DepTable.
if (head.haschanged(nlofile) || (nlofile.exists() && nlofile.isFileEmpty())) {
int const ret = runMakeIndexNomencl(file, ".nlo", ".nls");
if (ret == Systemcall::KILLED)
return Systemcall::KILLED;
if (ret == Systemcall::KILLED || ret == Systemcall::TIMEOUT)
return ret;
rerun = true;
}
@ -375,8 +375,8 @@ int LaTeX::run(TeXErrors & terr)
updateBibtexDependencies(head, bibtex_info);
int exit_code;
rerun |= runBibTeX(bibtex_info, runparams, exit_code);
if (exit_code == Systemcall::KILLED)
return Systemcall::KILLED;
if (exit_code == Systemcall::KILLED || exit_code == Systemcall::TIMEOUT)
return exit_code;
FileName const blgfile(changeExtension(file.absFileName(), ".blg"));
if (blgfile.exists())
bscanres = scanBlgFile(head, terr);
@ -406,8 +406,8 @@ int LaTeX::run(TeXErrors & terr)
LYXERR(Debug::LATEX, "Run #" << count);
message(runMessage(count));
int exit_code = startscript();
if (exit_code == Systemcall::KILLED)
return Systemcall::KILLED;
if (exit_code == Systemcall::KILLED || exit_code == Systemcall::TIMEOUT)
return exit_code;
scanres = scanLogFile(terr);
// update the depedencies
@ -436,8 +436,8 @@ int LaTeX::run(TeXErrors & terr)
updateBibtexDependencies(head, bibtex_info);
int exit_code;
rerun |= runBibTeX(bibtex_info, runparams, exit_code);
if (exit_code == Systemcall::KILLED)
return Systemcall::KILLED;
if (exit_code == Systemcall::KILLED || exit_code == Systemcall::TIMEOUT)
return exit_code;
FileName const blgfile(changeExtension(file.absFileName(), ".blg"));
if (blgfile.exists())
bscanres = scanBlgFile(head, terr);
@ -459,8 +459,8 @@ int LaTeX::run(TeXErrors & terr)
// onlyFileName() is needed for cygwin
int const ret = runMakeIndex(onlyFileName(changeExtension(
file.absFileName(), ".idx")), runparams);
if (ret == Systemcall::KILLED)
return Systemcall::KILLED;
if (ret == Systemcall::KILLED || ret == Systemcall::TIMEOUT)
return ret;
FileName const ilgfile(changeExtension(file.absFileName(), ".ilg"));
if (ilgfile.exists())
iscanres = scanIlgFile(terr);

View File

@ -424,6 +424,7 @@ bool queryStopCommand(QString const & cmd)
bool SystemcallPrivate::waitWhile(State waitwhile, bool process_events, int timeout)
{
timeout = 1000;
if (!process_)
return false;
@ -440,7 +441,7 @@ bool SystemcallPrivate::waitWhile(State waitwhile, bool process_events, int time
while (!timedout) {
if (process_->waitForFinished(timeout))
return true;
bool stop = queryStopCommand(cmd_);
bool const stop = queryStopCommand(cmd_);
// The command may have finished in the meantime
if (process_->state() == QProcess::NotRunning)
return true;
@ -475,7 +476,7 @@ bool SystemcallPrivate::waitWhile(State waitwhile, bool process_events, int time
return false;
if (timer.elapsed() > timeout) {
bool stop = queryStopCommand(cmd_);
bool const stop = queryStopCommand(cmd_);
// The command may have finished in the meantime
if (process_->state() == QProcess::NotRunning)
break;