return retval_;
}
- command_ = libScriptSearch(trim(what));
+ command_ = commandPrep(trim(what));
signal_.reset();
return run(Wait);
}
int ForkedCall::startScript(string const & what, SignalTypePtr signal)
{
- command_ = libScriptSearch(trim(what));
+ command_ = commandPrep(trim(what));
signal_ = signal;
return run(DontWait);
/** Start the child process.
*
* The command "what" is passed to execvp() for execution. "$$s" is
- * replaced accordingly by libScriptSearch().
+ * replaced accordingly by commandPrep().
*
* There are two startScript commands available. They differ in that
* the second receives a signal that is executed on completion of
int Systemcall::startscript(Starttype how, string const & what,
std::string const & path, bool /*process_events*/)
{
- string const python_call = "python -tt";
- string command = to_filesystem8bit(from_utf8(latexEnvCmdPrefix(path)));
- string what_ss = libScriptSearch(what);
-
- if (prefixIs(what_ss, python_call))
- command += os::python() + what_ss.substr(python_call.length());
- else
- command += what_ss;
+ string command = to_filesystem8bit(from_utf8(latexEnvCmdPrefix(path)))
+ + commandPrep(what);
if (how == DontWait) {
switch (os::shell()) {
int Systemcall::startscript(Starttype how, string const & what,
string const & path, bool process_events)
{
- string const what_ss = libScriptSearch(what);
+ string const what_ss = commandPrep(what);
LYXERR(Debug::INFO,"Running: " << what_ss);
string infile;
/** Start child process.
* The string "what" contains a commandline with arguments separated
* by spaces and encoded in the filesystem encoding. "$$s" will be
- * replaced accordingly by libScriptSearch(). The string "path"
- * contains the path to be prepended to the TEXINPUTS environment
- * variable and encoded in the path to be prepended to the TEXINPUTS
- * environment variable and utf-8. Unset "process_events" in case UI
- * should be blocked while processing the external command.
+ * replaced accordingly by commandPrep(). The string "path" contains
+ * the path to be prepended to the TEXINPUTS environment variable and
+ * encoded in the path to be prepended to the TEXINPUTS environment
+ * variable and utf-8. Unset "process_events" in case UI should be
+ * blocked while processing the external command.
*/
int startscript(Starttype how, std::string const & what,
std::string const & path = empty_string(),
}
-string const libScriptSearch(string const & command_in)
+string const commandPrep(string const & command_in)
{
static string const token_scriptpath = "$$s/";
+ string const python_call = "python -tt";
string command = command_in;
+ if (prefixIs(command_in, python_call))
+ command = os::python() + command_in.substr(python_call.length());
+
// Find the starting position of "$$s/"
string::size_type const pos1 = command.find(token_scriptpath);
if (pos1 == string::npos)
command.erase(pos1, 4);
} else {
quote_style style = quote_shell;
- string const python_call = "python -tt";
- if (prefixIs(command, python_call) || prefixIs(command, os::python()))
+ if (prefixIs(command, os::python()))
style = quote_python;
// Replace "$$s/foo/some_script" with "<path to>/some_script".
* command will still fail, but the error message will make some sort of
* sense ;-)
*/
-std::string const libScriptSearch(std::string const & command);
+std::string const commandPrep(std::string const & command);
enum latex_path_extension {
PROTECT_EXTENSION,