SSH: Streamline SshRemoteProcessRunner's output handling.

Make it just like SshRemoteProcess (and QProcess). The current
implementation annoyingly forces client code to establish additional
signal/slot connections, even if they only want to evaluate the output
at the end.

Change-Id: Id8c30dd156574d7d26d848d8e0705856a16d3747
Reviewed-by: hjk <qthjk@ovi.com>
This commit is contained in:
Christian Kandeler
2012-06-08 09:42:32 +02:00
committed by hjk
parent 303e67304e
commit 79de09f266
24 changed files with 111 additions and 181 deletions

View File

@@ -349,13 +349,14 @@ void StartGdbServerDialog::handleProcessStarted()
logMessage(tr("Starting gdbserver..."));
}
void StartGdbServerDialog::handleProcessOutputAvailable(const QByteArray &ba)
void StartGdbServerDialog::handleProcessOutputAvailable()
{
logMessage(QString::fromUtf8(ba.trimmed()));
logMessage(QString::fromUtf8(d->runner.readAllStandardOutput().trimmed()));
}
void StartGdbServerDialog::handleProcessErrorOutput(const QByteArray &ba)
void StartGdbServerDialog::handleProcessErrorOutput()
{
const QByteArray ba = d->runner.readAllStandardError();
logMessage(QString::fromUtf8(ba.trimmed()));
// "Attached; pid = 16740"
// "Listening on port 10000"
@@ -397,10 +398,8 @@ void StartGdbServerDialog::startGdbServerOnPort(int port, int pid)
LinuxDeviceConfiguration::ConstPtr device = d->currentDevice();
connect(&d->runner, SIGNAL(connectionError()), SLOT(handleConnectionError()));
connect(&d->runner, SIGNAL(processStarted()), SLOT(handleProcessStarted()));
connect(&d->runner, SIGNAL(processOutputAvailable(QByteArray)),
SLOT(handleProcessOutputAvailable(QByteArray)));
connect(&d->runner, SIGNAL(processErrorOutputAvailable(QByteArray)),
SLOT(handleProcessErrorOutput(QByteArray)));
connect(&d->runner, SIGNAL(readyReadStandardOutput()), SLOT(handleProcessOutputAvailable()));
connect(&d->runner, SIGNAL(readyReadStandardError()), SLOT(handleProcessErrorOutput()));
connect(&d->runner, SIGNAL(processClosed(int)), SLOT(handleProcessClosed(int)));
QByteArray cmd = "/usr/bin/gdbserver --attach :"