Use python isolate mode

This (more or less) avoids user's environment variables tampering the
search process.
And also remove usages of `eval()` and `exec()`.

PR #18995.
This commit is contained in:
Chocobo1
2023-05-21 14:04:44 +08:00
committed by GitHub
parent 34802362ad
commit 4ef8f39f23
6 changed files with 40 additions and 15 deletions

View File

@@ -509,7 +509,12 @@ void SearchPluginManager::update()
QProcess nova;
nova.setProcessEnvironment(QProcessEnvironment::systemEnvironment());
const QStringList params {(engineLocation() / Path(u"/nova2.py"_qs)).toString(), u"--capabilities"_qs};
const QStringList params
{
Utils::ForeignApps::PYTHON_ISOLATE_MODE_FLAG,
(engineLocation() / Path(u"/nova2.py"_qs)).toString(),
u"--capabilities"_qs
};
nova.start(Utils::ForeignApps::pythonInfo().executableName, params, QIODevice::ReadOnly);
nova.waitForFinished();