LYXERR(Debug::FILES, "No converter defined! "
"I use convertDefault.py:\n\t" << command);
Systemcall one;
- one.startscript(Systemcall::Wait, command,
- buffer ? buffer->filePath() : string(),
- buffer ? buffer->layoutPos() : string());
+ Systemcall::Starttype starttype =
+ (buffer && buffer->isClone()) ?
+ Systemcall::WaitLoop : Systemcall::Wait;
+ int const exitval = one.startscript(starttype, command,
+ buffer ? buffer->filePath() : string(),
+ buffer ? buffer->layoutPos() : string());
+ if (exitval == Systemcall::KILLED) {
+ frontend::Alert::warning(
+ _("Converter killed"),
+ bformat(_("The running converter\n %1$s\nwas killed by the user."),
+ from_utf8(command)));
+ return false;
+ }
if (to_file.isReadableFile()) {
if (conversionflags & try_cache)
ConverterCache::get().add(orig_from,
if (buffer) {
runparams.use_japanese =
- buffer->params().bufferFormat() == "latex"
+ (buffer->params().bufferFormat() == "latex"
+ || suffixIs(buffer->params().bufferFormat(), "-ja"))
&& buffer->params().encoding().package() == Encoding::japanese;
runparams.use_indices = buffer->params().use_indices;
runparams.bibtex_command = buffer->params().bibtexCommand();
&& !contains(command, "-shell-escape"))
command += " -shell-escape ";
LYXERR(Debug::FILES, "Running " << command);
+ // FIXME KILLED
+ // Check changed return value here.
if (!runLaTeX(*buffer, command, runparams, errorList))
return false;
} else {
LYXERR(Debug::FILES, "Running "
<< command
<< " to update aux file");
+ // FIXME KILLED
+ // Check changed return value here.
if (!runLaTeX(*buffer, command,
runparams, errorList))
return false;
// We're not waiting for the result, so we can't do anything
// else here.
} else {
- res = one.startscript(Systemcall::Wait,
+ Systemcall::Starttype starttype =
+ (buffer && buffer->isClone()) ?
+ Systemcall::WaitLoop : Systemcall::Wait;
+ res = one.startscript(starttype,
to_filesystem8bit(from_utf8(command)),
buffer ? buffer->filePath()
: string(),
buffer ? buffer->layoutPos()
: string());
+ if (res == Systemcall::KILLED) {
+ frontend::Alert::warning(
+ _("Converter killed"),
+ bformat(_("The running converter\n %1$s\nwas killed by the user."),
+ from_utf8(command)));
+ return false;
+ }
+
if (!real_outfile.empty()) {
Mover const & mover = getMover(conv.to());
if (!mover.rename(outfile, real_outfile))
string const command2 = conv.parselog() +
" < " + quoteName(infile2 + ".out") +
" > " + quoteName(logfile);
- one.startscript(Systemcall::Wait,
+ res = one.startscript(starttype,
to_filesystem8bit(from_utf8(command2)),
buffer->filePath(),
buffer->layoutPos());
+ if (res == Systemcall::KILLED) {
+ frontend::Alert::warning(
+ _("Converter killed"),
+ bformat(_("The running converter\n %1$s\nwas killed by the user."),
+ from_utf8(command)));
+ return false;
+ }
if (!scanLog(*buffer, command, makeAbsPath(logfile, path), errorList))
return false;
}
}
if (res) {
- if (conv.to() == "program") {
+ if (res == Systemcall::KILLED) {
+ Alert::information(_("Process Killed"),
+ bformat(_("The conversion process was killed while running:\n%1$s"),
+ wrapParas(from_utf8(command))));
+ } else if (res == Systemcall::TIMEOUT) {
+ Alert::information(_("Process Timed Out"),
+ bformat(_("The conversion process:\n%1$s\ntimed out before completing."),
+ wrapParas(from_utf8(command))));
+ } else if (conv.to() == "program") {
Alert::error(_("Build errors"),
_("There were errors during the build process."));
} else {
}
+// FIXME KILL
+// Probably need to return an INT here
bool Converters::runLaTeX(Buffer const & buffer, string const & command,
OutputParams const & runparams, ErrorList & errorList)
{
string const name = buffer.latexName();
LaTeX latex(command, runparams, FileName(makeAbsPath(name)),
buffer.filePath(), buffer.layoutPos(),
- buffer.lastPreviewError());
+ buffer.isClone(), buffer.lastPreviewError());
TeXErrors terr;
// The connection closes itself at the end of the scope when latex is
// destroyed. One cannot close (and destroy) buffer while the converter is
});
int const result = latex.run(terr);
+ if (result == Systemcall::KILLED) {
+ Alert::error(_("Export canceled"),
+ _("The export process was terminated by the user."));
+ return result;
+ }
+
if (result & LaTeX::ERRORS)
buffer.bufferErrors(terr, errorList);