On Wed, Oct 28, 2015 at 08:12:44PM -0400, PhilipPirrip wrote: > I've been playing with SystemcallPrivate::startProcess (in Systemcall.cpp) > and latexEnvCmdPrefix (in filetools.cpp), in an attempt to resolve the issue > with missing BIBINPUTS, a 9 year old request at > http://www.lyx.org/trac/ticket/2645 > > Enrico mentioned there that setEnvironment couldn't be used to set the > environments due to a bug, and that BIBINPUTS and TEXINPUTS can only be > defined in shell escape commands of latexEnvCmdPrefix. > Now that setEnvironment is deprecated, setProcessEnvironment can be used, > and it turned out that it works... at least for me, on Linux.
I am sorry, but it still doesn't work. You can verify this by yourself as follows. Put the 3 attached files in the same directory and make executable the script myprog (chmod 755 myprog). Then execute the following commands: 1) qmake test-env.pro 2) make 3) ./test-env As you can see, it works because setProcessEnvironment() is not used. Now do: 1) make clean 2) qmake QMAKE_CXXFLAGS+=-DSETENV test-env.pro 3) make 4) ./test-env As you can see, now it doesn't work because setProcessEnvironment() is used. However, even when https://bugreports.qt.io/browse/QTBUG-19885 is solved (if ever), we would still be stuck with the current way of setting the environment because QProcess does not execute batch files on Windows and doing as you suggest would introduce a regression. > In a more conservative approach, BIBINPUTS support could be added by the > patch I proposed on http://www.lyx.org/trac/ticket/2645 This can be done, if now the limit for a command line on Windows is 8191 characters as documented at https://support.microsoft.com/en-us/kb/830473 but you are forgetting BSTINPUTS and TEXFONTS. Unfortunately, there was no discussion about the way it should be implemented. I mean, while always setting TEXINPUTS seems reasonable, I don't think it is the same for all other variables, and I am actually not really sure that carrying the settings of TEXINPUTS is a good idea. Maybe we can use the following scheme: - set BIBINPUTS if the directory <docdir>/bib exists - set BSTINPUTS if the directory <docdir>/bst exists - set TEXFONTS if the directory <docdir>/fonts exists so that one can put the relevant files in an appropriate subdir in the document dir. > Anyhow, please consider having BIBINPUTS defined in LyX 2.2. PLEASE ;) I have not so much time ATM, but I will see what I can do. -- Enrico
eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' && eval 'exec perl -S $0 $argv:q' if 0; print "it works"; exit(0);
#include <QProcess> #include <QDebug> #include <QtCore> int main() { QProcess *proc = new QProcess(); #ifdef SETENV proc->setProcessEnvironment(QProcessEnvironment::systemEnvironment()); #endif proc->setProcessChannelMode(QProcess::MergedChannels); proc->start("./myprog"); if (proc->waitForFinished()) qDebug() << "Output:" << proc->readAll(); else qDebug() << "Fail:" << proc->errorString(); proc->close(); delete proc; return 0; }
HEADERS = SOURCES = test-env.cpp