X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Fsupport%2FSystemcall.cpp;h=bc7790adb17cdd8f8dbd4f123836e6bb5610a09d;hb=f8cc30a1f20de97425d17fc1779041d0f963f74a;hp=7588d4aa3eb784dd3315602a0ae559ea7a71deba;hpb=e5cc5ac2e82f6dd1939b35b138489d1a1e3d3bae;p=lyx.git diff --git a/src/support/Systemcall.cpp b/src/support/Systemcall.cpp index 7588d4aa3e..bc7790adb1 100644 --- a/src/support/Systemcall.cpp +++ b/src/support/Systemcall.cpp @@ -100,8 +100,13 @@ ProgressInterface* ProgressInterface::instance() int Systemcall::startscript(Starttype how, string const & what, std::string const & path, bool /*process_events*/) { - string command = - to_filesystem8bit(from_utf8(latexEnvCmdPrefix(path))) + what; + string const python_call = "python -tt"; + string command = to_filesystem8bit(from_utf8(latexEnvCmdPrefix(path))); + + if (prefixIs(what, python_call)) + command += os::python() + what.substr(python_call.length()); + else + command += what; if (how == DontWait) { switch (os::shell()) { @@ -162,9 +167,16 @@ string const parsecmd(string const & inputcmd, string & outfile) bool in_single_quote = false; bool in_double_quote = false; bool escaped = false; + string const python_call = "python -tt"; string cmd; + int start = 0; + + if (prefixIs(inputcmd, python_call)) { + cmd = os::python(); + start = python_call.length(); + } - for (size_t i = 0; i < inputcmd.length(); ++i) { + for (size_t i = start; i < inputcmd.length(); ++i) { char c = inputcmd[i]; if (c == '\'') { if (in_double_quote || escaped) { @@ -212,7 +224,7 @@ int Systemcall::startscript(Starttype how, string const & what, string const & path, bool process_events) { string outfile; - QString cmd = toqstr(parsecmd(what, outfile)); + QString cmd = QString::fromLocal8Bit(parsecmd(what, outfile).c_str()); SystemcallPrivate d(outfile); @@ -257,7 +269,7 @@ SystemcallPrivate::SystemcallPrivate(const std::string& of) : if (!out_file_.empty()) { // Check whether we have to simply throw away the output. if (out_file_ != os::nulldev()) - process_->setStandardOutputFile(toqstr(out_file_)); + process_->setStandardOutputFile(QString::fromLocal8Bit(out_file_.c_str())); } connect(process_, SIGNAL(readyReadStandardOutput()), SLOT(stdOut()));