From 4a3d6bada2245509ce4f9ea138c6ab5b994b89da Mon Sep 17 00:00:00 2001 From: houchengqiu Date: Wed, 30 Aug 2023 14:41:26 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E8=A7=A3=E5=86=B3=E5=AF=BC=E5=87=BA?= =?UTF-8?q?=E5=B4=A9=E6=BA=83=E6=97=A5=E5=BF=97=E5=A4=B1=E8=B4=A5=E7=9A=84?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 仅有coredump文件才从标准输出读取压缩进度,其他时候不读取。 Log: 解决导出崩溃日志失败的问题 Bug: https://pms.uniontech.com/bug-view-217019.html --- application/logexportthread.cpp | 44 +++++++++++++++++++-------------- 1 file changed, 26 insertions(+), 18 deletions(-) diff --git a/application/logexportthread.cpp b/application/logexportthread.cpp index 298ae15e..43e80d31 100644 --- a/application/logexportthread.cpp +++ b/application/logexportthread.cpp @@ -3359,8 +3359,11 @@ bool LogExportThread::exportToZip(const QString &fileName, const QListexportLog(tmpPath, it.storagePath, true); + if (it.coreFile == "present") + nCoreDumpCount++; if (!m_canRunning) { break; } @@ -3378,26 +3381,31 @@ bool LogExportThread::exportToZip(const QString &fileName, const QList lines = QString(dd).split('\n', QString::SkipEmptyParts); - for (const QString &line : qAsConst(lines)) { - int pos = line.indexOf(QLatin1Char('%')); - if (pos > 1) { - int percentage = line.midRef(pos - 3, 3).toInt(); - sigProgress(percentage, 100); + // 有coredump文件,才读取压缩进度 + if (nCoreDumpCount > 0) { + connect(&procss, &QProcess::readyReadStandardOutput, this, [&](){ + if (!m_canRunning) { + procss.kill(); + ret = false; + return; } - } + + qInfo() << "recive proces done.."; + QByteArray dd = procss.readAllStandardOutput(); + QList lines = QString(dd).split('\n', QString::SkipEmptyParts); + for (const QString &line : qAsConst(lines)) { + int pos = line.indexOf(QLatin1Char('%')); + if (pos > 1) { + int percentage = line.midRef(pos - 3, 3).toInt(); + sigProgress(percentage, 100); + } + } + ret = true; + }); + } else { ret = true; - qDebug() << "route process slot ret:" << ret; - }); + } + procss.start("/bin/bash", arg); procss.waitForFinished(-1);