diff --git a/gui/ollie9pclient.cpp b/gui/ollie9pclient.cpp index 2465df0..2e32cd3 100644 --- a/gui/ollie9pclient.cpp +++ b/gui/ollie9pclient.cpp @@ -338,7 +338,7 @@ bool Ollie9pClient::createSession(const QString &cwd, const QString &name, const if (!model.isEmpty()) agentArgs << "model=" + model; if (!agent.isEmpty()) agentArgs << "agent=" + agent; if (!remote.isEmpty()) agentArgs << "remote=" + remote; - if (!agentAlias.isEmpty()) agentArgs << "agent_alias=" + agentAlias; + if (!agentAlias.isEmpty()) agentArgs << "name=" + agentAlias; QProcess proc; QStringList args = {"-a", serverAddr(), "rdwr", "session/" + sessName + "/agent/new"}; @@ -409,12 +409,16 @@ bool Ollie9pClient::renameAgent(const QString &sessionId, const QString &agentId return false; } + // Write name= to the agent's ctl file — Plan 9 style. QProcess proc; proc.setProgram(bin); - proc.setArguments({"-a", serverAddr(), "mv", - "session/" + sessionId + "/agent/" + agentId, - "session/" + sessionId + "/agent/" + newName}); + proc.setArguments({"-a", serverAddr(), "rdwr", + "session/" + sessionId + "/agent/" + agentId + "/ctl"}); proc.start(); + proc.waitForStarted(3000); + QByteArray input = QString("name=" + newName + "\n").toUtf8(); + proc.write(input); + proc.closeWriteChannel(); proc.waitForFinished(5000); if (proc.exitCode() != 0) { @@ -422,7 +426,7 @@ bool Ollie9pClient::renameAgent(const QString &sessionId, const QString &agentId return false; } - if (m_activeSessionId == sessionId && m_agentId == agentId) { + if (m_activeSessionId == sessionId) { m_agentId = newName; emit activeAgentIdChanged(); }