Journald: Do not try to read journal entries for remote applications

Task-number: QTCREATORBUG-20995
Change-Id: I27911183084f8423ab7638b9443949a84c47b953
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Tobias Hunger
2018-08-27 14:09:31 +02:00
parent 2f41886c4b
commit 944aa963a8

View File

@@ -952,21 +952,24 @@ RunControl::RunControl(RunConfiguration *runConfiguration, Core::Id mode) :
d(std::make_unique<RunControlPrivate>(this, runConfiguration, mode))
{
#ifdef WITH_JOURNALD
JournaldWatcher::instance()->subscribe(this, [this](const JournaldWatcher::LogEntry &entry) {
if (entry.value("_MACHINE_ID") != JournaldWatcher::instance()->machineId())
return;
if (!device().isNull() && device()->type() == ProjectExplorer::Constants::DESKTOP_DEVICE_TYPE) {
JournaldWatcher::instance()->subscribe(this, [this](const JournaldWatcher::LogEntry &entry) {
const QByteArray pid = entry.value("_PID");
if (pid.isEmpty())
return;
if (entry.value("_MACHINE_ID") != JournaldWatcher::instance()->machineId())
return;
const qint64 pidNum = static_cast<qint64>(QString::fromLatin1(pid).toInt());
if (pidNum != d->applicationProcessHandle.pid())
return;
const QByteArray pid = entry.value("_PID");
if (pid.isEmpty())
return;
const QString message = QString::fromUtf8(entry.value("MESSAGE")) + "\n";
appendMessageRequested(this, message, Utils::OutputFormat::LogMessageFormat);
});
const qint64 pidNum = static_cast<qint64>(QString::fromLatin1(pid).toInt());
if (pidNum != d->applicationProcessHandle.pid())
return;
const QString message = QString::fromUtf8(entry.value("MESSAGE")) + "\n";
appendMessageRequested(this, message, Utils::OutputFormat::LogMessageFormat);
});
}
#endif
}