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