diff options
author | Ulf Hermann <[email protected]> | 2014-03-13 17:33:47 +0100 |
---|---|---|
committer | Ulf Hermann <[email protected]> | 2014-03-14 11:43:43 +0100 |
commit | f9864efea787226d0a4039c6bfc7b1cd24d7ebd2 (patch) | |
tree | ada6a3a5d12d85cd104d0daf9267199e22bf8fba /src/plugins/android/androidrunner.cpp | |
parent | ffbb129f183b49281bd6376f6982f52cb8f07a9a (diff) |
Android: Properly split stderr into lines and drop unrelated messages
Change-Id: I860cddcea23692fd8c9b69b849e7b1fb50e9113d
Reviewed-by: Daniel Teske <[email protected]>
Diffstat (limited to 'src/plugins/android/androidrunner.cpp')
-rw-r--r-- | src/plugins/android/androidrunner.cpp | 31 |
1 files changed, 18 insertions, 13 deletions
diff --git a/src/plugins/android/androidrunner.cpp b/src/plugins/android/androidrunner.cpp index d92cc7eb043..cf047deceb3 100644 --- a/src/plugins/android/androidrunner.cpp +++ b/src/plugins/android/androidrunner.cpp @@ -351,24 +351,17 @@ void AndroidRunner::stop() m_adbLogcatProcess.waitForFinished(); } -void AndroidRunner::logcatReadStandardError() +void AndroidRunner::logcatProcess(const QByteArray &text, QByteArray &buffer, bool onlyError) { - emit remoteErrorOutput(m_adbLogcatProcess.readAllStandardError()); -} - -void AndroidRunner::logcatReadStandardOutput() -{ - if (m_processPID == -1) - return; - QList<QByteArray> lines = m_adbLogcatProcess.readAllStandardOutput().split('\n'); + QList<QByteArray> lines = text.split('\n'); // lines always contains at least one item - lines[0].prepend(m_logcat); + lines[0].prepend(buffer); if (!lines.last().endsWith('\n')) { // incomplete line - m_logcat = lines.last(); + buffer = lines.last(); lines.removeLast(); } else { - m_logcat.clear(); + buffer.clear(); } QByteArray pid(QString::fromLatin1("%1):").arg(m_processPID).toLatin1()); @@ -378,7 +371,7 @@ void AndroidRunner::logcatReadStandardOutput() if (line.endsWith('\r')) line.chop(1); line.append('\n'); - if (line.startsWith("E/") + if (onlyError || line.startsWith("E/") || line.startsWith("D/Qt") || line.startsWith("W/")) emit remoteErrorOutput(line); @@ -388,6 +381,18 @@ void AndroidRunner::logcatReadStandardOutput() } } +void AndroidRunner::logcatReadStandardError() +{ + if (m_processPID != -1) + logcatProcess(m_adbLogcatProcess.readAllStandardError(), m_stderrBuffer, true); +} + +void AndroidRunner::logcatReadStandardOutput() +{ + if (m_processPID != -1) + logcatProcess(m_adbLogcatProcess.readAllStandardOutput(), m_stdoutBuffer, false); +} + void AndroidRunner::adbKill(qint64 pid) { { |