Refine environment variable scope

Previously the proxy environment variable will affect the qbt process globally. Now it is
limited to where it required.
This commit is contained in:
Chocobo1
2025-03-22 04:47:46 +08:00
parent 8c8a0ac54c
commit 943e403241
4 changed files with 55 additions and 43 deletions

View File

@@ -70,7 +70,7 @@ SearchHandler::SearchHandler(const QString &pattern, const QString &category, co
, m_searchTimeout {new QTimer(this)}
{
// Load environment variables (proxy)
m_searchProcess->setEnvironment(QProcess::systemEnvironment());
m_searchProcess->setProcessEnvironment(m_manager->proxyEnvironment());
m_searchProcess->setProgram(Utils::ForeignApps::pythonInfo().executableName);
#if defined(Q_OS_UNIX) && (QT_VERSION >= QT_VERSION_CHECK(6, 6, 0))
m_searchProcess->setUnixProcessParameters(QProcess::UnixProcessFlag::CloseFileDescriptors);