forked from qt-creator/qt-creator
Android: Fix package name search
Android 7.0 ps doesn't add \r anymore to the EOL. Task-number: QTCREATORBUG-16782 Change-Id: Iff596ac2c1eafd0c5422cbac5708c8b616c73ecf Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -241,10 +241,16 @@ static int extractPidFromChunk(const QByteArray &chunk, int from)
|
||||
|
||||
static int extractPid(const QString &exeName, const QByteArray &psOutput)
|
||||
{
|
||||
const QByteArray needle = exeName.toUtf8() + '\r';
|
||||
const int to = psOutput.indexOf(needle);
|
||||
if (to == -1)
|
||||
return -1;
|
||||
static char psEol[]={'\r', '\n'};
|
||||
QByteArray needle = exeName.toUtf8() + psEol[0];
|
||||
int to = psOutput.indexOf(needle);
|
||||
if (to == -1) {
|
||||
needle = exeName.toUtf8() + psEol[1];
|
||||
to = psOutput.indexOf(needle);
|
||||
if (to == -1)
|
||||
return -1;
|
||||
std::swap(psEol[0], psEol[1]);
|
||||
}
|
||||
const int from = psOutput.lastIndexOf('\n', to);
|
||||
if (from == -1)
|
||||
return -1;
|
||||
|
Reference in New Issue
Block a user