#include "support/ForkedCalls.h"
#include "support/debug.h"
+#include "support/environment.h"
#include "support/filetools.h"
#include "support/lstrings.h"
#include "support/lyxlib.h"
#include "support/bind.h"
+#include "LyXRC.h"
+
#include <cerrno>
#include <queue>
#include <sstream>
//
/////////////////////////////////////////////////////////////////////
+ForkedCall::ForkedCall(string const & path)
+ : cmd_prefix_(empty_string())
+{
+ if (path.empty() || lyxrc.texinputs_prefix.empty())
+ return;
+
+ string const texinputs = os::latex_path_list(
+ replaceCurdirPath(path, lyxrc.texinputs_prefix));
+ string const sep = string(1, os::path_separator(os::TEXENGINE));
+ string const env = getEnv("TEXINPUTS");
+
+ if (os::shell() == os::UNIX)
+ cmd_prefix_ = "env 'TEXINPUTS=." + sep + texinputs
+ + sep + env + "' ";
+ else
+ cmd_prefix_ = "cmd /p /c set TEXINPUTS=." + sep + texinputs
+ + sep + env + " & ";
+}
+
int ForkedCall::startScript(Starttype wait, string const & what)
{
// generate child in background
int ForkedCall::generateChild()
{
- string line = trim(command_);
+ string const line = trim(cmd_prefix_ + command_);
if (line.empty())
return 1;