From c4d6f2a1b9f9ad03e74d3d03e569996bf91f02a0 Mon Sep 17 00:00:00 2001 From: Levi Neely <141506390+lneely@users.noreply.github.com> Date: Sat, 1 Aug 2026 18:50:19 +0200 Subject: [PATCH] gui: use rdwr (not write) for session/new and agent/new --- gui/ollie9pclient.cpp | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/gui/ollie9pclient.cpp b/gui/ollie9pclient.cpp index 1a013ce..24bc0a0 100644 --- a/gui/ollie9pclient.cpp +++ b/gui/ollie9pclient.cpp @@ -268,14 +268,14 @@ bool Ollie9pClient::createSession(const QString &cwd, const QString &name, const { if (cwd.isEmpty()) return false; - // Step 1: Create the session (name only) + // Step 1: Create the session (name only) using rdwr (write then read back result) QString sessName = name; { QProcess proc; - QStringList args = {"-a", serverAddr(), "write", "session/new"}; + QStringList args = {"-a", serverAddr(), "rdwr", "session/new"}; proc.start(ninepBin(), args); proc.waitForStarted(3000); - QString input = "name=" + sessName; + QString input = "name=" + sessName + "\n"; proc.write(input.toUtf8()); proc.closeWriteChannel(); proc.waitForFinished(5000); @@ -286,13 +286,13 @@ bool Ollie9pClient::createSession(const QString &cwd, const QString &name, const qDebug() << "createSession (step 1) failed:" << err; return false; } - // Read the returned session name (may be auto-generated) + // Read the returned session name (auto-generated if blank) QByteArray out = proc.readAllStandardOutput().trimmed(); if (!out.isEmpty()) sessName = QString::fromUtf8(out); } - // Step 2: Create the agent within the session + // Step 2: Create the agent within the session using rdwr { QStringList agentArgs; agentArgs << "cwd=" + cwd; @@ -303,10 +303,11 @@ bool Ollie9pClient::createSession(const QString &cwd, const QString &name, const if (!agentAlias.isEmpty()) agentArgs << "agent_alias=" + agentAlias; QProcess proc; - QStringList args = {"-a", serverAddr(), "write", "session/" + sessName + "/agent/new"}; + QStringList args = {"-a", serverAddr(), "rdwr", "session/" + sessName + "/agent/new"}; proc.start(ninepBin(), args); proc.waitForStarted(3000); - proc.write(agentArgs.join(" ").toUtf8()); + QString input = agentArgs.join(" ") + "\n"; + proc.write(input.toUtf8()); proc.closeWriteChannel(); proc.waitForFinished(5000);