diff options
author | Daniel Teske <daniel.teske@digia.com> | 2014-02-13 12:55:19 +0100 |
---|---|---|
committer | Daniel Teske <daniel.teske@digia.com> | 2014-02-14 15:22:08 +0100 |
commit | 30caf88a584ac6189bed9584f1ca5acd07df5489 (patch) | |
tree | ba9656c6e05c622cee716245f5ac353e46781c8d /src/plugins/android/androidrunner.cpp | |
parent | 497b2ae45dbc996a9a8e7a655734eaf25124c549 (diff) | |
download | qt-creator-30caf88a584ac6189bed9584f1ca5acd07df5489.tar.gz |
AndroidRunner: Handle incomplete lines better
Task-number: QTCREATORBUG-11472
Change-Id: If2479d3ccb85857a8775894b1f4088702578ecba
Reviewed-by: jian liang <jianliang79@gmail.com>
Reviewed-by: Daniel Teske <daniel.teske@digia.com>
Diffstat (limited to 'src/plugins/android/androidrunner.cpp')
-rw-r--r-- | src/plugins/android/androidrunner.cpp | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/src/plugins/android/androidrunner.cpp b/src/plugins/android/androidrunner.cpp index d496855c5b..08f7be5bfd 100644 --- a/src/plugins/android/androidrunner.cpp +++ b/src/plugins/android/androidrunner.cpp @@ -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) |