diff options
author | Katja Marttila <katja.marttila@qt.io> | 2017-05-08 11:58:08 +0300 |
---|---|---|
committer | Katja Marttila <katja.marttila@qt.io> | 2017-05-10 06:00:10 +0000 |
commit | bb671cba0a2ffcb0f165d373a51b76a57a7dfacc (patch) | |
tree | 8ff894df74683b833b8df5421b447637ce3781cf /src/libs/installer/packagemanagercore_p.cpp | |
parent | a1694a8ea3e34df7d06cb36275200f08ec54ce59 (diff) |
Fix install corrupt with silentInstall
If there are updates available for a component that is executable and the
executable is running, installer is unable to update the component and
results to a corrupted install. Check that there are no processes running
from the install tree and cancel update if there are any. The update is
canceled if there are processes running even if the process does not get
update.
Task-number: QTIFW-969
Change-Id: I5614cdd21d8538ccf8b0d114d3616804fe367667
Reviewed-by: Iikka Eklund <iikka.eklund@qt.io>
Diffstat (limited to 'src/libs/installer/packagemanagercore_p.cpp')
-rw-r--r-- | src/libs/installer/packagemanagercore_p.cpp | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/libs/installer/packagemanagercore_p.cpp b/src/libs/installer/packagemanagercore_p.cpp index 5fa2b0515..ef5dd3d48 100644 --- a/src/libs/installer/packagemanagercore_p.cpp +++ b/src/libs/installer/packagemanagercore_p.cpp @@ -2421,4 +2421,26 @@ void PackageManagerCorePrivate::processFilesForDelayedDeletion() } } +void PackageManagerCorePrivate::findExecutablesRecursive(const QString &path, const QStringList &excludeFiles, QStringList *result) +{ + QString executable; + QDirIterator it(path, QDir::NoDotAndDotDot | QDir::Executable | QDir::Files | QDir::System, QDirIterator::Subdirectories ); + + while (it.hasNext()) { + executable = it.next(); + foreach (QString exclude, excludeFiles) { + if (executable.compare(exclude, Qt::CaseInsensitive) != 0) + result->append(executable); + } + } +} + +QStringList PackageManagerCorePrivate::runningInstallerProcesses(const QStringList &excludeFiles) +{ + QStringList resultFiles; + findExecutablesRecursive(QCoreApplication::applicationDirPath(), excludeFiles, &resultFiles); + return checkRunningProcessesFromList(resultFiles); +} + + } // namespace QInstaller |