Commit 30caf88a authored by Daniel Teske's avatar Daniel Teske

AndroidRunner: Handle incomplete lines better

Task-number: QTCREATORBUG-11472
Change-Id: If2479d3ccb85857a8775894b1f4088702578ecba
Reviewed-by: default avatarjian liang <jianliang79@gmail.com>
Reviewed-by: default avatarDaniel Teske <daniel.teske@digia.com>
parent 497b2ae4
......@@ -358,11 +358,19 @@ void AndroidRunner::logcatReadStandardError()
void AndroidRunner::logcatReadStandardOutput()
{
m_logcat += m_adbLogcatProcess.readAllStandardOutput();
bool keepLastLine = m_logcat.endsWith('\n');
QByteArray line;
QList<QByteArray> lines = m_adbLogcatProcess.readAllStandardOutput().split('\n');
// lines always contains at least one item
lines[0].prepend(m_logcat);
if (!lines.last().endsWith('\n')) {
// incomplete line
m_logcat = lines.last();
lines.removeLast();
} else {
m_logcat.clear();
}
QByteArray pid(QString::fromLatin1("%1):").arg(m_processPID).toLatin1());
foreach (line, m_logcat.split('\n')) {
foreach (QByteArray line, lines) {
if (!line.contains(pid))
continue;
if (line.endsWith('\r'))
......@@ -376,8 +384,6 @@ void AndroidRunner::logcatReadStandardOutput()
emit remoteOutput(line);
}
if (keepLastLine)
m_logcat = line;
}
void AndroidRunner::adbKill(qint64 pid)
......
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