Commit 54636d97 authored by Daniel Teske's avatar Daniel Teske

Android: Remove various waitForFinished(-1)

That waits forever. For processes that should finish in a reasonable
time, we should not wait forever. I changed most of the waits to 5s,
all of those functions do handle a failed waitForFinished. I doubt
that all callers do also handle it correctly, but that's probably
still better than waiting forever.

Task-number: QTCREATORBUG-10868
Change-Id: I368a911f19a4f81d71b24cf9d58796bd99878040
Reviewed-by: default avatarEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>
parent 559e66cb
......@@ -250,7 +250,7 @@ void AndroidConfigurations::updateAvailableSdkPlatforms()
QProcess proc;
proc.setProcessEnvironment(androidToolEnvironment().toProcessEnvironment());
proc.start(androidToolPath().toString(), QStringList() << QLatin1String("list") << QLatin1String("target")); // list avaialbe AVDs
if (!proc.waitForFinished(-1)) {
if (!proc.waitForFinished(5000)) {
proc.terminate();
return;
}
......@@ -460,7 +460,7 @@ QVector<AndroidDeviceInfo> AndroidConfigurations::connectedDevices(QString *erro
QVector<AndroidDeviceInfo> devices;
QProcess adbProc;
adbProc.start(adbToolPath().toString(), QStringList() << QLatin1String("devices"));
if (!adbProc.waitForFinished(-1)) {
if (!adbProc.waitForFinished(5000)) {
adbProc.kill();
if (error)
*error = tr("Could not run: %1").arg(adbToolPath().toString() + QLatin1String(" devices"));
......@@ -579,7 +579,7 @@ bool AndroidConfigurations::removeAVD(const QString &name) const
proc.start(androidToolPath().toString(),
QStringList() << QLatin1String("delete") << QLatin1String("avd")
<< QLatin1String("-n") << name);
if (!proc.waitForFinished(-1)) {
if (!proc.waitForFinished(5000)) {
proc.terminate();
return false;
}
......@@ -593,7 +593,7 @@ QVector<AndroidDeviceInfo> AndroidConfigurations::androidVirtualDevices() const
proc.setProcessEnvironment(androidToolEnvironment().toProcessEnvironment());
proc.start(androidToolPath().toString(),
QStringList() << QLatin1String("list") << QLatin1String("avd")); // list available AVDs
if (!proc.waitForFinished(-1)) {
if (!proc.waitForFinished(5000)) {
proc.terminate();
return devices;
}
......@@ -725,7 +725,7 @@ bool AndroidConfigurations::isBootToQt(const QString &device) const
QProcess adbProc;
adbProc.start(adbToolPath().toString(), arguments);
if (!adbProc.waitForFinished(-1)) {
if (!adbProc.waitForFinished(5000)) {
adbProc.kill();
return false;
}
......@@ -741,7 +741,7 @@ int AndroidConfigurations::getSDKVersion(const QString &device) const
QProcess adbProc;
adbProc.start(adbToolPath().toString(), arguments);
if (!adbProc.waitForFinished(-1)) {
if (!adbProc.waitForFinished(5000)) {
adbProc.kill();
return -1;
}
......@@ -764,7 +764,7 @@ QString AndroidConfigurations::getProductModel(const QString &device) const
QProcess adbProc;
adbProc.start(adbToolPath().toString(), arguments);
if (!adbProc.waitForFinished(-1)) {
if (!adbProc.waitForFinished(5000)) {
adbProc.kill();
return device;
}
......@@ -784,7 +784,7 @@ bool AndroidConfigurations::hasFinishedBooting(const QString &device) const
QProcess adbProc;
adbProc.start(adbToolPath().toString(), arguments);
if (!adbProc.waitForFinished(-1)) {
if (!adbProc.waitForFinished(5000)) {
adbProc.kill();
return false;
}
......@@ -807,7 +807,7 @@ QStringList AndroidConfigurations::getAbis(const QString &device) const
QProcess adbProc;
adbProc.start(adbToolPath().toString(), arguments);
if (!adbProc.waitForFinished(-1)) {
if (!adbProc.waitForFinished(5000)) {
adbProc.kill();
return result;
}
......
......@@ -281,7 +281,7 @@ unsigned int AndroidDeployStep::remoteModificationTime(const QString &fullDestin
QStringList arguments = AndroidDeviceInfo::adbSelector(m_deviceSerialNumber);
arguments << QLatin1String("ls") << destination;
process.start(AndroidConfigurations::instance().adbToolPath().toString(), arguments);
process.waitForFinished(-1);
process.waitForFinished(5000);
if (process.error() != QProcess::UnknownError
|| process.exitCode() != 0)
return -1;
......
......@@ -217,7 +217,7 @@ void AndroidRunner::asyncStart()
emit remoteProcessFinished(tr("Failed to forward C++ debugging ports. Reason: %1.").arg(adb.errorString()));
return;
}
if (!adb.waitForFinished(-1)) {
if (!adb.waitForFinished(5000)) {
emit remoteProcessFinished(tr("Failed to forward C++ debugging ports."));
return;
}
......@@ -260,7 +260,7 @@ void AndroidRunner::asyncStart()
emit remoteProcessFinished(tr("Failed to start the activity. Reason: %1.").arg(adb.errorString()));
return;
}
if (!adb.waitForFinished(-1)) {
if (!adb.waitForFinished(5000)) {
adb.terminate();
emit remoteProcessFinished(tr("Unable to start '%1'.").arg(m_packageName));
return;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment