Add error handling to QProcesses run at startup.

Give warnings about failures to be able to fix things/timeouts on
slow machines. Pass on arguments correctly on Windows.
Make sure processes are killed on timeouts.
This commit is contained in:
Friedemann Kleint
2010-09-08 15:22:58 +02:00
parent ba03239749
commit cb23999fbf
4 changed files with 283 additions and 187 deletions

View File

@@ -31,6 +31,8 @@
#include "cmakeprojectconstants.h"
#include "cmakeproject.h"
#include <utils/synchronousprocess.h>
#include <coreplugin/icore.h>
#include <coreplugin/uniqueidmanager.h>
#include <projectexplorer/projectexplorerconstants.h>
@@ -139,8 +141,15 @@ QString CMakeManager::qtVersionForQMake(const QString &qmakePath)
{
QProcess qmake;
qmake.start(qmakePath, QStringList(QLatin1String("--version")));
if (!qmake.waitForFinished())
if (!qmake.waitForStarted()) {
qWarning("Cannot start '%s': %s", qPrintable(qmakePath), qPrintable(qmake.errorString()));
return QString();
}
if (!qmake.waitForFinished()) {
Utils::SynchronousProcess::stopProcess(qmake);
qWarning("Timeout running '%s'.", qPrintable(qmakePath));
return QString();
}
QString output = qmake.readAllStandardOutput();
QRegExp regexp(QLatin1String("(QMake version|Qmake version:)[\\s]*([\\d.]*)"));
regexp.indexIn(output);