summaryrefslogtreecommitdiff
path: root/src/plugins/debugger/debuggeritemmanager.cpp
diff options
context:
space:
mode:
authorTobias Hunger <tobias.hunger@qt.io>2016-04-29 16:52:58 +0200
committerTobias Hunger <tobias.hunger@qt.io>2016-05-11 10:04:38 +0000
commitddefe062c73e35def585f8fc6c90a4f18e47c0f4 (patch)
tree03c3aecc501c03b92e259fe0ae1c4d472033b7e5 /src/plugins/debugger/debuggeritemmanager.cpp
parent1a248b1b932e2c7c42e25993d921e78c52aa4bcf (diff)
downloadqt-creator-ddefe062c73e35def585f8fc6c90a4f18e47c0f4.tar.gz
Fix up QProcess::waitForFinished()
waitForFinish returns false if the process is no longer running at the time of the call. Handle that throughout the codebase. Change-Id: Ia7194095454e82efbd4eb88f2d55926bdd09e094 Reviewed-by: hjk <hjk@theqtcompany.com>
Diffstat (limited to 'src/plugins/debugger/debuggeritemmanager.cpp')
-rw-r--r--src/plugins/debugger/debuggeritemmanager.cpp25
1 files changed, 13 insertions, 12 deletions
diff --git a/src/plugins/debugger/debuggeritemmanager.cpp b/src/plugins/debugger/debuggeritemmanager.cpp
index e5716e4a15..c02a87f9c2 100644
--- a/src/plugins/debugger/debuggeritemmanager.cpp
+++ b/src/plugins/debugger/debuggeritemmanager.cpp
@@ -33,12 +33,12 @@
#include <utils/fileutils.h>
#include <utils/persistentsettings.h>
#include <utils/qtcassert.h>
+#include <utils/synchronousprocess.h>
#include <utils/hostosinfo.h>
#include <QDebug>
#include <QDir>
#include <QFileInfo>
-#include <QProcess>
using namespace Core;
using namespace ProjectExplorer;
@@ -225,17 +225,18 @@ void DebuggerItemManager::autoDetectGdbOrLldbDebuggers()
FileNameList suspects;
if (HostOsInfo::isMacHost()) {
- QProcess lldbInfo;
- lldbInfo.start(QLatin1String("xcrun"), QStringList() << QLatin1String("--find")
- << QLatin1String("lldb"));
- if (!lldbInfo.waitForFinished(2000)) {
- lldbInfo.kill();
- lldbInfo.waitForFinished();
- } else {
- QByteArray lPath = lldbInfo.readAll();
- const QFileInfo fi(QString::fromLocal8Bit(lPath.data(), lPath.size() -1));
- if (fi.exists() && fi.isExecutable() && !fi.isDir())
- suspects.append(FileName::fromString(fi.absoluteFilePath()));
+ SynchronousProcess lldbInfo;
+ lldbInfo.setTimeoutS(2);
+ SynchronousProcessResponse response
+ = lldbInfo.run(QLatin1String("xcrun"), QStringList() << QLatin1String("--find")
+ << QLatin1String("lldb"));
+ if (response.result == Utils::SynchronousProcessResponse::Finished) {
+ QString lPath = response.allOutput();
+ if (!lPath.isEmpty()) {
+ const QFileInfo fi(lPath);
+ if (fi.exists() && fi.isExecutable() && !fi.isDir())
+ suspects.append(FileName::fromString(fi.absoluteFilePath()));
+ }
}
}