Don't leak parent file descriptors to child processes

It is unexpected for the child process to inherit parent file descriptors.
Requires Qt >= 6.6 and only affects Linux.

Closes #10312.
PR #22457.
This commit is contained in:
Chocobo1
2025-03-23 14:48:21 +08:00
committed by GitHub
parent 627d89813c
commit d21653e8cf
6 changed files with 20 additions and 3 deletions

View File

@@ -42,6 +42,9 @@ SearchDownloadHandler::SearchDownloadHandler(const QString &pluginName, const QS
, m_downloadProcess {new QProcess(this)}
{
m_downloadProcess->setEnvironment(QProcess::systemEnvironment());
#if defined(Q_OS_UNIX) && (QT_VERSION >= QT_VERSION_CHECK(6, 6, 0))
m_downloadProcess->setUnixProcessParameters(QProcess::UnixProcessFlag::CloseFileDescriptors);
#endif
connect(m_downloadProcess, qOverload<int, QProcess::ExitStatus>(&QProcess::finished)
, this, &SearchDownloadHandler::downloadProcessFinished);
const QStringList params