gui: use rdwr (not write) for session/new and agent/new
This commit is contained in:
parent
153b40cbc7
commit
c4d6f2a1b9
|
|
@ -268,14 +268,14 @@ bool Ollie9pClient::createSession(const QString &cwd, const QString &name, const
|
||||||
{
|
{
|
||||||
if (cwd.isEmpty()) return false;
|
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;
|
QString sessName = name;
|
||||||
{
|
{
|
||||||
QProcess proc;
|
QProcess proc;
|
||||||
QStringList args = {"-a", serverAddr(), "write", "session/new"};
|
QStringList args = {"-a", serverAddr(), "rdwr", "session/new"};
|
||||||
proc.start(ninepBin(), args);
|
proc.start(ninepBin(), args);
|
||||||
proc.waitForStarted(3000);
|
proc.waitForStarted(3000);
|
||||||
QString input = "name=" + sessName;
|
QString input = "name=" + sessName + "\n";
|
||||||
proc.write(input.toUtf8());
|
proc.write(input.toUtf8());
|
||||||
proc.closeWriteChannel();
|
proc.closeWriteChannel();
|
||||||
proc.waitForFinished(5000);
|
proc.waitForFinished(5000);
|
||||||
|
|
@ -286,13 +286,13 @@ bool Ollie9pClient::createSession(const QString &cwd, const QString &name, const
|
||||||
qDebug() << "createSession (step 1) failed:" << err;
|
qDebug() << "createSession (step 1) failed:" << err;
|
||||||
return false;
|
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();
|
QByteArray out = proc.readAllStandardOutput().trimmed();
|
||||||
if (!out.isEmpty())
|
if (!out.isEmpty())
|
||||||
sessName = QString::fromUtf8(out);
|
sessName = QString::fromUtf8(out);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Step 2: Create the agent within the session
|
// Step 2: Create the agent within the session using rdwr
|
||||||
{
|
{
|
||||||
QStringList agentArgs;
|
QStringList agentArgs;
|
||||||
agentArgs << "cwd=" + cwd;
|
agentArgs << "cwd=" + cwd;
|
||||||
|
|
@ -303,10 +303,11 @@ bool Ollie9pClient::createSession(const QString &cwd, const QString &name, const
|
||||||
if (!agentAlias.isEmpty()) agentArgs << "agent_alias=" + agentAlias;
|
if (!agentAlias.isEmpty()) agentArgs << "agent_alias=" + agentAlias;
|
||||||
|
|
||||||
QProcess proc;
|
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.start(ninepBin(), args);
|
||||||
proc.waitForStarted(3000);
|
proc.waitForStarted(3000);
|
||||||
proc.write(agentArgs.join(" ").toUtf8());
|
QString input = agentArgs.join(" ") + "\n";
|
||||||
|
proc.write(input.toUtf8());
|
||||||
proc.closeWriteChannel();
|
proc.closeWriteChannel();
|
||||||
proc.waitForFinished(5000);
|
proc.waitForFinished(5000);
|
||||||
|
|
||||||
|
|
|
||||||
Reference in New Issue