mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-28 20:45:47 +00:00
Exit with error if child exits with error (#10188)
Before, it could have been the case that lyx -e pdf2 file.lyx had exit code 0 even though file.lyx includes a file that exits with error. If compiled in the GUI a warning was given, but from the command line exit code it would seem there was no problem. The exit code for this case is now non-zero and the word "Warning" is now removed from the message because it should be treated as an error. An exception is thrown from InsetInclude and is caught in Buffer::makeLaTeXFile() and added to the error list. The (similar) use case at #8840 is also fixed by this commit.
This commit is contained in:
parent
7fd60406df
commit
1a374a931b
@ -62,6 +62,7 @@
|
|||||||
#include "support/lstrings.h" // contains
|
#include "support/lstrings.h" // contains
|
||||||
#include "support/lyxalgo.h"
|
#include "support/lyxalgo.h"
|
||||||
#include "support/mutex.h"
|
#include "support/mutex.h"
|
||||||
|
#include "support/ExceptionMessage.h"
|
||||||
|
|
||||||
#include "support/bind.h"
|
#include "support/bind.h"
|
||||||
|
|
||||||
@ -702,7 +703,7 @@ void InsetInclude::latex(otexstream & os, OutputParams const & runparams) const
|
|||||||
onlyPath().absFileName(), runparams, Buffer::OnlyBody)) {
|
onlyPath().absFileName(), runparams, Buffer::OnlyBody)) {
|
||||||
if (!runparams.silent) {
|
if (!runparams.silent) {
|
||||||
docstring msg = bformat(_("Included file `%1$s' "
|
docstring msg = bformat(_("Included file `%1$s' "
|
||||||
"was not exported correctly.\nWarning: "
|
"was not exported correctly.\n "
|
||||||
"LaTeX export is probably incomplete."),
|
"LaTeX export is probably incomplete."),
|
||||||
included_file.displayName());
|
included_file.displayName());
|
||||||
ErrorList const & el = tmp->errorList("Export");
|
ErrorList const & el = tmp->errorList("Export");
|
||||||
@ -710,7 +711,8 @@ void InsetInclude::latex(otexstream & os, OutputParams const & runparams) const
|
|||||||
msg = bformat(from_ascii("%1$s\n\n%2$s\n\n%3$s"),
|
msg = bformat(from_ascii("%1$s\n\n%2$s\n\n%3$s"),
|
||||||
msg, el.begin()->error,
|
msg, el.begin()->error,
|
||||||
el.begin()->description);
|
el.begin()->description);
|
||||||
Alert::warning(_("Export failure"), msg);
|
throw ExceptionMessage(ErrorException, _("Error: "),
|
||||||
|
msg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
runparams.encoding = oldEnc;
|
runparams.encoding = oldEnc;
|
||||||
@ -727,14 +729,15 @@ void InsetInclude::latex(otexstream & os, OutputParams const & runparams) const
|
|||||||
|
|
||||||
if (!success && !runparams.silent) {
|
if (!success && !runparams.silent) {
|
||||||
docstring msg = bformat(_("Included file `%1$s' "
|
docstring msg = bformat(_("Included file `%1$s' "
|
||||||
"was not exported correctly.\nWarning: "
|
"was not exported correctly.\n "
|
||||||
"LaTeX export is probably incomplete."),
|
"LaTeX export is probably incomplete."),
|
||||||
included_file.displayName());
|
included_file.displayName());
|
||||||
if (!el.empty())
|
if (!el.empty())
|
||||||
msg = bformat(from_ascii("%1$s\n\n%2$s\n\n%3$s"),
|
msg = bformat(from_ascii("%1$s\n\n%2$s\n\n%3$s"),
|
||||||
msg, el.begin()->error,
|
msg, el.begin()->error,
|
||||||
el.begin()->description);
|
el.begin()->description);
|
||||||
Alert::warning(_("Export failure"), msg);
|
throw ExceptionMessage(ErrorException, _("Error: "),
|
||||||
|
msg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user