gui: re-discover agent ID on state stream start to pick up renames
This commit is contained in:
parent
79d031ff04
commit
74d346418d
|
|
@ -364,6 +364,17 @@ void Ollie9pClient::startChatStream()
|
|||
void Ollie9pClient::startStateStream()
|
||||
{
|
||||
if (m_stateProc) return;
|
||||
// Re-discover agent ID — directory may have been renamed
|
||||
QByteArray out = run9p({"ls", "session/" + m_activeSessionId + "/agent"});
|
||||
QString agents = QString::fromUtf8(out).trimmed();
|
||||
if (!agents.isEmpty()) {
|
||||
QString newId = agents.split('\n').first().trimmed();
|
||||
if (newId != m_agentId) {
|
||||
m_agentId = newId;
|
||||
emit activeAgentIdChanged();
|
||||
}
|
||||
}
|
||||
|
||||
m_stateProc = new QProcess(this);
|
||||
connect(m_stateProc, &QProcess::readyReadStandardOutput, this, &Ollie9pClient::onStateReadyRead);
|
||||
connect(m_stateProc, QOverload<int, QProcess::ExitStatus>::of(&QProcess::finished),
|
||||
|
|
|
|||
Reference in New Issue