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
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 20 additions and 3 deletions

View file

@ -674,6 +674,9 @@ void Application::runExternalProgram(const QString &programTemplate, const BitTo
QProcess proc;
proc.setProgram(command);
proc.setArguments(args);
#if defined(Q_OS_UNIX) && (QT_VERSION >= QT_VERSION_CHECK(6, 6, 0))
proc.setUnixProcessParameters(QProcess::UnixProcessFlag::CloseFileDescriptors);
#endif
if (proc.startDetached())
{