diff options
Diffstat (limited to 'src/plugins/qnx/slog2inforunner.cpp')
-rw-r--r-- | src/plugins/qnx/slog2inforunner.cpp | 39 |
1 files changed, 18 insertions, 21 deletions
diff --git a/src/plugins/qnx/slog2inforunner.cpp b/src/plugins/qnx/slog2inforunner.cpp index 58509782c5b..77700804b21 100644 --- a/src/plugins/qnx/slog2inforunner.cpp +++ b/src/plugins/qnx/slog2inforunner.cpp @@ -3,13 +3,13 @@ #include "slog2inforunner.h" -#include "qnxdevice.h" #include "qnxtr.h" +#include <projectexplorer/devicesupport/idevice.h> #include <projectexplorer/runconfigurationaspects.h> +#include <utils/process.h> #include <utils/qtcassert.h> -#include <utils/qtcprocess.h> #include <QRegularExpression> @@ -31,50 +31,47 @@ Slog2InfoRunner::Slog2InfoRunner(RunControl *runControl) void Slog2InfoRunner::start() { - using namespace Utils::Tasking; + using namespace Tasking; QTC_CHECK(!m_taskTree); - const auto testStartHandler = [this](QtcProcess &process) { + const auto testStartHandler = [this](Process &process) { process.setCommand({device()->filePath("slog2info"), {}}); }; - const auto testDoneHandler = [this](const QtcProcess &) { + const auto testDoneHandler = [this](const Process &) { m_found = true; }; - const auto testErrorHandler = [this](const QtcProcess &) { - QnxDevice::ConstPtr qnxDevice = device().dynamicCast<const QnxDevice>(); - if (qnxDevice && qnxDevice->qnxVersion() > 0x060500) { - appendMessage(Tr::tr("Warning: \"slog2info\" is not found on the device, " - "debug output not available."), ErrorMessageFormat); - } + const auto testErrorHandler = [this](const Process &) { + appendMessage(Tr::tr("Warning: \"slog2info\" is not found on the device, " + "debug output not available."), ErrorMessageFormat); }; - const auto launchTimeStartHandler = [this](QtcProcess &process) { + const auto launchTimeStartHandler = [this](Process &process) { process.setCommand({device()->filePath("date"), "+\"%d %H:%M:%S\"", CommandLine::Raw}); }; - const auto launchTimeDoneHandler = [this](const QtcProcess &process) { + const auto launchTimeDoneHandler = [this](const Process &process) { QTC_CHECK(!m_applicationId.isEmpty()); QTC_CHECK(m_found); m_launchDateTime = QDateTime::fromString(process.cleanedStdOut().trimmed(), "dd HH:mm:ss"); }; - const auto logStartHandler = [this](QtcProcess &process) { + const auto logStartHandler = [this](Process &process) { process.setCommand({device()->filePath("slog2info"), {"-w"}}); - connect(&process, &QtcProcess::readyReadStandardOutput, this, [&] { + connect(&process, &Process::readyReadStandardOutput, this, [&] { processLogInput(QString::fromLatin1(process.readAllRawStandardOutput())); }); - connect(&process, &QtcProcess::readyReadStandardError, this, [&] { + connect(&process, &Process::readyReadStandardError, this, [&] { appendMessage(QString::fromLatin1(process.readAllRawStandardError()), StdErrFormat); }); }; - const auto logErrorHandler = [this](const QtcProcess &process) { + const auto logErrorHandler = [this](const Process &process) { appendMessage(Tr::tr("Cannot show slog2info output. Error: %1").arg(process.errorString()), StdErrFormat); }; - const Tasking::Group root { - Process(testStartHandler, testDoneHandler, testErrorHandler), - Process(launchTimeStartHandler, launchTimeDoneHandler), - Process(logStartHandler, {}, logErrorHandler) + const Group root { + ProcessTask(testStartHandler, testDoneHandler, testErrorHandler), + ProcessTask(launchTimeStartHandler, launchTimeDoneHandler), + ProcessTask(logStartHandler, {}, logErrorHandler) }; m_taskTree.reset(new TaskTree(root)); |