On Thu, Mar 28, 2013 at 8:37 AM, Vincent van Ravesteijn <v...@lyx.org> wrote: > > > On Thu, Mar 28, 2013 at 8:19 AM, Scott Kostyshak <skost...@lyx.org> wrote: >> >> See attached patch. >> >> Before, 'lyx -e pdf2' would give no error and would exit with 0. A use >> case is if a user has in a bash script the following command: >> >> lyx -e pdf2 "${mylxyfile}" || exit 1 >> >> where 'lyx' is mispelled as 'lxy' and thus yields an empty >> string. If LyX does not exit with an error, the script continues where >> the user probably intends for it to stop. >> >> Can it go in? >> >> Scott > > > What if the filename is not empty, but the file does not exist ? Does it > exit with an error in that case ?
It exits with code 1 but does not display an error message. The attached patch fixes this. Is it OK? Scott
From 2434abd7cc74cc9283ee5844502a975ab9024a1d Mon Sep 17 00:00:00 2001 From: Scott Kostyshak <skost...@lyx.org> Date: Thu, 28 Mar 2013 03:46:35 -0400 Subject: [PATCH] Give an error message when LyX cannot load a file Before, the following command correctly exited with code 1, but it now also gives the reason for exiting: lyx -e pdf2 doesNotExist --- src/LyX.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/LyX.cpp b/src/LyX.cpp index b412033..c8fb9ca 100644 --- a/src/LyX.cpp +++ b/src/LyX.cpp @@ -502,6 +502,8 @@ bool LyX::loadFiles() } else { pimpl_->buffer_list_.release(buf); + lyxerr << "LyX failed to load the following file:\n" + << fname.absFileName() << endl; success = false; } } -- 1.7.9.5