public:
ProgressDummy() {}
- void processStarted(QString const &) {}
- void processFinished(QString const &) {}
- void appendMessage(QString const &) {}
- void appendError(QString const &) {}
- void clearMessages() {}
- void lyxerrFlush() {}
-
- void lyxerrConnect() {}
- void lyxerrDisconnect() {}
-
- void warning(QString const &, QString const &) {}
- void toggleWarning(QString const &, QString const &, QString const &) {}
- void error(QString const &, QString const &, QString const &) {}
- void information(QString const &, QString const &) {}
+ void processStarted(QString const &) override {}
+ void processFinished(QString const &) override {}
+ void appendMessage(QString const &) override {}
+ void appendError(QString const &) override {}
+ void clearMessages() override {}
+ void lyxerrFlush() override {}
+
+ void lyxerrConnect() override {}
+ void lyxerrDisconnect() override {}
+
+ void warning(QString const &, QString const &) override {}
+ void toggleWarning(QString const &, QString const &, QString const &) override {}
+ void error(QString const &, QString const &, QString const &) override {}
+ void information(QString const &, QString const &) override {}
int prompt(docstring const &, docstring const &, int default_but, int,
- docstring const &, docstring const &) { return default_but; }
+ docstring const &, docstring const &) override { return default_but; }
};
bool in_single_quote = false;
bool in_double_quote = false;
bool escaped = false;
- string const python_call = "python -tt";
+ string const python_call = os::python();
vector<string> outcmd(4);
size_t start = 0;
}
} else if (c == '<' && !(in_double_quote || escaped)) {
o = 3;
+#if defined (USE_MACOSX_PACKAGING)
+ } else if (o == 0 && i > 4 && c == ' ' && !(in_double_quote || escaped)) {
+ // if a macOS app is detected with an additional argument
+ // use open command as prefix to get it work
+ const size_t apos = outcmd[o].rfind(".app");
+ const size_t len = outcmd[o].length();
+ const bool quoted = outcmd[o].at(len - 1) == '"' && outcmd[o].at(0) == '"';
+ const string & ocmd = "open -a ";
+ if (apos != string::npos &&
+ (apos == (len - 4) || (apos == (len - 5) && quoted)) &&
+ !prefixIs(trim(outcmd[o]), ocmd)) {
+ outcmd[o] = ocmd + outcmd[o];
+ }
+ outcmd[o] += c;
+#endif
} else {
if (escaped && in_double_quote)
outcmd[o] += '\\';
}
if (!d.waitWhile(SystemcallPrivate::Running, do_events,
- os::timeout_min() * 60 * 1000)) {
+ os::timeout_ms())) {
if (d.state == SystemcallPrivate::Killed) {
LYXERR0("Killed: " << cmd);
return KILLED;
string const & lpath, bool detached)
{
cmd_ = cmd;
+#if (QT_VERSION >= QT_VERSION_CHECK(5, 15, 0))
+ // FIXME pass command and arguments separated in the first place
+ /* The versions of startDetached() and start() that accept a
+ * QStringList object exist since Qt4, but it is only in Qt 5.15
+ * that splitCommand() was introduced and the plain versions of
+ * start/startDetached() have been deprecated.
+ * The cleanest solution would be to have parsecmd() produce a
+ * QStringList for arguments, instead of transforming the string
+ * into something that the QProcess splitter accepts.
+ *
+ * Another reason for doing that is that the Qt parser ignores
+ * empty "" arguments, which are needed in some instances (see
+ * e.g. the work around for modules in Converter:convert. See
+ * QTBUG-80640 for a discussion.
+ */
+ QStringList arguments = QProcess::splitCommand(toqstr(latexEnvCmdPrefix(path, lpath)) + cmd_);
+ QString command = (arguments.empty()) ? QString() : arguments.first();
+ if (arguments.size() == 1)
+ arguments.clear();
+ else if (!arguments.empty())
+ arguments.removeFirst();
+#endif
if (detached) {
state = SystemcallPrivate::Running;
#ifdef Q_OS_WIN32
if (err_file_.empty())
process_->setStandardErrorFile(QProcess::nullDevice());
#endif
+#if (QT_VERSION >= QT_VERSION_CHECK(5, 15, 0))
+ if (!QProcess::startDetached(command, arguments)) {
+#else
if (!QProcess::startDetached(toqstr(latexEnvCmdPrefix(path, lpath)) + cmd_)) {
+#endif
state = SystemcallPrivate::Error;
return;
}
delete released;
} else if (process_) {
state = SystemcallPrivate::Starting;
+#if (QT_VERSION >= QT_VERSION_CHECK(5, 15, 0))
+ process_->start(command, arguments);
+#else
process_->start(toqstr(latexEnvCmdPrefix(path, lpath)) + cmd_);
+#endif
}
}
while (!timedout) {
if (process_->waitForFinished(timeout))
return true;
- bool stop = queryStopCommand(cmd_);
+ bool const stop = queryStopCommand(cmd_);
// The command may have finished in the meantime
if (process_->state() == QProcess::NotRunning)
return true;
return false;
if (timer.elapsed() > timeout) {
- bool stop = queryStopCommand(cmd_);
+ bool const stop = queryStopCommand(cmd_);
// The command may have finished in the meantime
if (process_->state() == QProcess::NotRunning)
break;