Commit 232724cc authored by Christian Kandeler's avatar Christian Kandeler

SSH: Make API of SshRemoteProcess more similar to the one of QProcess.

In the end, we want to derive it from QIODevice as well.

Change-Id: I30e7cb23ec8e5753c363d1f4457b650556860ac2
Reviewed-by: default avatarChristian Kandeler <christian.kandeler@nokia.com>
parent 75a7bf29
......@@ -103,12 +103,11 @@ void SshRemoteProcess::init()
{
connect(d, SIGNAL(started()), this, SIGNAL(started()),
Qt::QueuedConnection);
connect(d, SIGNAL(outputAvailable(QByteArray)), this,
SIGNAL(outputAvailable(QByteArray)), Qt::QueuedConnection);
connect(d, SIGNAL(errorOutputAvailable(QByteArray)), this,
SIGNAL(errorOutputAvailable(QByteArray)), Qt::QueuedConnection);
connect(d, SIGNAL(closed(int)), this, SIGNAL(closed(int)),
connect(d, SIGNAL(readyReadStandardOutput()), this, SIGNAL(readyReadStandardOutput()),
Qt::QueuedConnection);
connect(d, SIGNAL(readyReadStandardError()), this,
SIGNAL(readyReadStandardError()), Qt::QueuedConnection);
connect(d, SIGNAL(closed(int)), this, SIGNAL(closed(int)), Qt::QueuedConnection);
}
void SshRemoteProcess::addToEnvironment(const QByteArray &var, const QByteArray &value)
......@@ -168,6 +167,9 @@ int SshRemoteProcess::exitCode() const { return d->m_exitCode; }
QByteArray SshRemoteProcess::exitSignal() const { return d->m_signal; }
QByteArray SshRemoteProcess::readAllStandardOutput() { return d->readAllStandardOutput(); }
QByteArray SshRemoteProcess::readAllStandardError() { return d->readAllStandardError(); }
namespace Internal {
SshRemoteProcessPrivate::SshRemoteProcessPrivate(const QByteArray &command,
......@@ -212,6 +214,20 @@ void SshRemoteProcessPrivate::setProcState(ProcessState newState)
}
}
QByteArray SshRemoteProcessPrivate::readAllStandardOutput()
{
const QByteArray data = m_stdout;
m_stdout.clear();
return data;
}
QByteArray SshRemoteProcessPrivate::readAllStandardError()
{
const QByteArray data = m_stderr;
m_stderr.clear();
return data;
}
void SshRemoteProcessPrivate::closeHook()
{
if (m_wasRunning) {
......@@ -268,16 +284,19 @@ void SshRemoteProcessPrivate::handleChannelFailure()
void SshRemoteProcessPrivate::handleChannelDataInternal(const QByteArray &data)
{
emit outputAvailable(data);
m_stdout += data;
emit readyReadStandardOutput();
}
void SshRemoteProcessPrivate::handleChannelExtendedDataInternal(quint32 type,
const QByteArray &data)
{
if (type != SSH_EXTENDED_DATA_STDERR)
if (type != SSH_EXTENDED_DATA_STDERR) {
qWarning("Unknown extended data type %u", type);
else
emit errorOutputAvailable(data);
} else {
m_stderr += data;
emit readyReadStandardError();
}
}
void SshRemoteProcessPrivate::handleExitStatus(const SshChannelExitStatus &exitStatus)
......
......@@ -92,6 +92,9 @@ public:
int exitCode() const;
QByteArray exitSignal() const;
QByteArray readAllStandardOutput();
QByteArray readAllStandardError();
// Note: This is ignored by the OpenSSH server.
void sendSignal(const QByteArray &signal);
void kill() { sendSignal(KillSignal); }
......@@ -100,8 +103,9 @@ public:
signals:
void started();
void outputAvailable(const QByteArray &output);
void errorOutputAvailable(const QByteArray &output);
void readyReadStandardOutput();
void readyReadStandardError();
/*
* Parameter is of type ExitStatus, but we use int because of
......
......@@ -60,10 +60,13 @@ public:
virtual void closeHook();
QByteArray readAllStandardOutput();
QByteArray readAllStandardError();
signals:
void started();
void outputAvailable(const QByteArray &output);
void errorOutputAvailable(const QByteArray &output);
void readyReadStandardOutput();
void readyReadStandardError();
void closed(int exitStatus);
private:
......@@ -96,6 +99,9 @@ private:
bool m_useTerminal;
SshPseudoTerminal m_terminal;
QByteArray m_stdout;
QByteArray m_stderr;
SshRemoteProcess *m_proc;
};
......
......@@ -74,6 +74,8 @@ private slots:
void handleDisconnected();
void handleProcessStarted();
void handleProcessFinished(int exitStatus);
void handleStdout();
void handleStderr();
private:
enum State { Inactive, Connecting, Connected, ProcessRunning };
......@@ -150,10 +152,8 @@ void SshRemoteProcessRunnerPrivate::handleConnected()
connect(m_process.data(), SIGNAL(started()), SLOT(handleProcessStarted()));
connect(m_process.data(), SIGNAL(closed(int)),
SLOT(handleProcessFinished(int)));
connect(m_process.data(), SIGNAL(outputAvailable(QByteArray)),
SIGNAL(processOutputAvailable(QByteArray)));
connect(m_process.data(), SIGNAL(errorOutputAvailable(QByteArray)),
SIGNAL(processErrorOutputAvailable(QByteArray)));
connect(m_process.data(), SIGNAL(readyReadStandardOutput()), SLOT(handleStdout()));
connect(m_process.data(), SIGNAL(readyReadStandardError()), SLOT(handleStderr()));
if (m_runInTerminal)
m_process->requestTerminal(m_terminal);
m_process->start();
......@@ -198,6 +198,16 @@ void SshRemoteProcessRunnerPrivate::handleProcessFinished(int exitStatus)
emit processClosed(exitStatus);
}
void SshRemoteProcessRunnerPrivate::handleStdout()
{
emit processOutputAvailable(m_process->readAllStandardOutput());
}
void SshRemoteProcessRunnerPrivate::handleStderr()
{
emit processErrorOutputAvailable(m_process->readAllStandardError());
}
void SshRemoteProcessRunnerPrivate::setState(State state)
{
if (m_state != state) {
......
......@@ -151,8 +151,8 @@ void RemoteGdbProcess::handleAppOutputReaderStarted()
QTC_ASSERT(m_state == StartingFifoReader, return);
setState(StartingGdb);
connect(m_appOutputReader.data(), SIGNAL(outputAvailable(QByteArray)),
this, SLOT(handleAppOutput(QByteArray)));
connect(m_appOutputReader.data(), SIGNAL(readyReadStandardOutput()),
this, SLOT(handleAppOutput()));
QByteArray cmdLine = "DISPLAY=:0.0 " + m_command.toUtf8() + ' '
+ Utils::QtcProcess::joinArgsUnix(m_cmdArgs).toUtf8()
+ " -tty=" + m_appOutputFileName;
......@@ -163,10 +163,10 @@ void RemoteGdbProcess::handleAppOutputReaderStarted()
SLOT(handleGdbStarted()));
connect(m_gdbProc.data(), SIGNAL(closed(int)), this,
SLOT(handleGdbFinished(int)));
connect(m_gdbProc.data(), SIGNAL(outputAvailable(QByteArray)), this,
SLOT(handleGdbOutput(QByteArray)));
connect(m_gdbProc.data(), SIGNAL(errorOutputAvailable(QByteArray)), this,
SLOT(handleErrOutput(QByteArray)));
connect(m_gdbProc.data(), SIGNAL(readyReadStandardOutput()), this,
SLOT(handleGdbOutput()));
connect(m_gdbProc.data(), SIGNAL(readyReadStandardError()), this,
SLOT(handleErrOutput()));
m_gdbProc->start();
}
......@@ -265,12 +265,13 @@ QString RemoteGdbProcess::errorString() const
return m_error;
}
void RemoteGdbProcess::handleGdbOutput(const QByteArray &output)
void RemoteGdbProcess::handleGdbOutput()
{
if (m_state == Inactive)
return;
QTC_ASSERT(m_state == RunningGdb, return);
const QByteArray &output = m_gdbProc->readAllStandardOutput();
// TODO: Carriage return removal still necessary?
m_currentGdbOutput += removeCarriageReturn(output);
#if 0
......@@ -343,16 +344,16 @@ void RemoteGdbProcess::sendInput(const QByteArray &data)
m_gdbProc->sendInput(data);
}
void RemoteGdbProcess::handleAppOutput(const QByteArray &output)
void RemoteGdbProcess::handleAppOutput()
{
if (m_state == RunningGdb)
m_adapter->handleApplicationOutput(output);
m_adapter->handleApplicationOutput(m_appOutputReader->readAllStandardOutput());
}
void RemoteGdbProcess::handleErrOutput(const QByteArray &output)
void RemoteGdbProcess::handleErrOutput()
{
if (m_state == RunningGdb) {
m_errorOutput += output;
m_errorOutput += m_gdbProc->readAllStandardError();
emit readyReadStandardError();
}
}
......
......@@ -88,9 +88,9 @@ private slots:
void handleAppOutputReaderFinished(int exitStatus);
void handleGdbStarted();
void handleGdbFinished(int exitStatus);
void handleGdbOutput(const QByteArray &output);
void handleAppOutput(const QByteArray &output);
void handleErrOutput(const QByteArray &output);
void handleGdbOutput();
void handleAppOutput();
void handleErrOutput();
private:
enum State {
......
......@@ -136,12 +136,9 @@ void MaemoRemoteMounter::unmount()
.arg(remoteSudo, m_mountSpecs.at(i).mountSpec.remoteMountPoint);
}
m_umountStderr.clear();
m_unmountProcess = m_connection->createRemoteProcess(remoteCall.toUtf8());
connect(m_unmountProcess.data(), SIGNAL(closed(int)), this,
SLOT(handleUnmountProcessFinished(int)));
connect(m_unmountProcess.data(), SIGNAL(errorOutputAvailable(QByteArray)),
this, SLOT(handleUmountStderr(QByteArray)));
setState(Unmounting);
m_unmountProcess->start();
}
......@@ -176,10 +173,9 @@ void MaemoRemoteMounter::handleUnmountProcessFinished(int exitStatus)
emit reportProgress(tr("Finished unmounting."));
emit unmounted();
} else {
if (!m_umountStderr.isEmpty()) {
errorMsg += tr("\nstderr was: '%1'")
.arg(QString::fromUtf8(m_umountStderr));
}
const QByteArray &umountStderr = m_unmountProcess->readAllStandardError();
if (!umountStderr.isEmpty())
errorMsg += tr("\nstderr was: '%1'").arg(QString::fromUtf8(umountStderr));
emit error(errorMsg);
}
}
......@@ -229,14 +225,11 @@ void MaemoRemoteMounter::startUtfsClients()
}
emit reportProgress(tr("Starting remote UTFS clients..."));
m_utfsClientStderr.clear();
m_mountProcess = m_connection->createRemoteProcess(remoteCall.toUtf8());
connect(m_mountProcess.data(), SIGNAL(started()), this,
SLOT(handleUtfsClientsStarted()));
connect(m_mountProcess.data(), SIGNAL(closed(int)), this,
SLOT(handleUtfsClientsFinished(int)));
connect(m_mountProcess.data(), SIGNAL(errorOutputAvailable(QByteArray)),
this, SLOT(handleUtfsClientStderr(QByteArray)));
m_mountProcess->start();
setState(UtfsClientsStarting);
......@@ -268,9 +261,9 @@ void MaemoRemoteMounter::handleUtfsClientsFinished(int exitStatus)
} else {
QString errMsg = tr("Failure running UTFS client: %1")
.arg(m_mountProcess->errorString());
if (!m_utfsClientStderr.isEmpty())
errMsg += tr("\nstderr was: '%1'")
.arg(QString::fromUtf8(m_utfsClientStderr));
const QByteArray &mountStderr = m_mountProcess->readAllStandardError();
if (!mountStderr.isEmpty())
errMsg += tr("\nstderr was: '%1'").arg(QString::fromUtf8(mountStderr));
emit error(errMsg);
}
}
......@@ -343,18 +336,6 @@ void MaemoRemoteMounter::handleUtfsServerFinished(int /* exitCode */,
handleUtfsServerError(static_cast<QProcess *>(sender())->error());
}
void MaemoRemoteMounter::handleUtfsClientStderr(const QByteArray &output)
{
if (m_state != Inactive)
m_utfsClientStderr += output;
}
void MaemoRemoteMounter::handleUmountStderr(const QByteArray &output)
{
if (m_state != Inactive)
m_umountStderr += output;
}
QString MaemoRemoteMounter::utfsClientOnDevice() const
{
return QLatin1String("/usr/lib/mad-developer/utfs-client");
......
......@@ -91,9 +91,7 @@ signals:
private slots:
void handleUtfsClientsStarted();
void handleUtfsClientsFinished(int exitStatus);
void handleUtfsClientStderr(const QByteArray &output);
void handleUnmountProcessFinished(int exitStatus);
void handleUmountStderr(const QByteArray &output);
void handleUtfsServerError(QProcess::ProcessError procError);
void handleUtfsServerFinished(int exitCode,
QProcess::ExitStatus exitStatus);
......@@ -134,8 +132,6 @@ private:
typedef QSharedPointer<QProcess> ProcPtr;
QList<ProcPtr> m_utfsServers;
QByteArray m_utfsClientStderr;
QByteArray m_umountStderr;
RemoteLinux::PortList *m_freePorts;
const RemoteLinux::RemoteLinuxUsedPortsGatherer *m_portsGatherer;
bool m_remoteMountsAllowed;
......
......@@ -233,10 +233,8 @@ void GenericDirectUploadService::handleMkdirFinished(int exitStatus)
// See comment in SftpChannel::createLink as to why we can't use it.
d->lnProc = connection()->createRemoteProcess(command.toUtf8());
connect(d->lnProc.data(), SIGNAL(closed(int)), SLOT(handleLnFinished(int)));
connect(d->lnProc.data(), SIGNAL(outputAvailable(QByteArray)),
SLOT(handleStdOutData(QByteArray)));
connect(d->lnProc.data(), SIGNAL(errorOutputAvailable(QByteArray)),
SLOT(handleStdErrData(QByteArray)));
connect(d->lnProc.data(), SIGNAL(readyReadStandardOutput()), SLOT(handleStdOutData()));
connect(d->lnProc.data(), SIGNAL(readyReadStandardError()), SLOT(handleStdErrData()));
d->lnProc->start();
} else {
const SftpJobId job = d->uploader->uploadFile(df.localFilePath, remoteFilePath,
......@@ -251,14 +249,18 @@ void GenericDirectUploadService::handleMkdirFinished(int exitStatus)
}
}
void GenericDirectUploadService::handleStdOutData(const QByteArray &data)
void GenericDirectUploadService::handleStdOutData()
{
emit stdOutData(QString::fromUtf8(data));
SshRemoteProcess * const process = qobject_cast<SshRemoteProcess *>(sender());
if (process)
emit stdOutData(QString::fromUtf8(process->readAllStandardOutput()));
}
void GenericDirectUploadService::handleStdErrData(const QByteArray &data)
void GenericDirectUploadService::handleStdErrData()
{
emit stdErrData(QString::fromUtf8(data));
SshRemoteProcess * const process = qobject_cast<SshRemoteProcess *>(sender());
if (process)
emit stdErrData(QString::fromUtf8(process->readAllStandardError()));
}
void GenericDirectUploadService::stopDeployment()
......@@ -328,10 +330,8 @@ void GenericDirectUploadService::uploadNextFile()
const QString command = QLatin1String("mkdir -p ") + dirToCreate;
d->mkdirProc = connection()->createRemoteProcess(command.toUtf8());
connect(d->mkdirProc.data(), SIGNAL(closed(int)), SLOT(handleMkdirFinished(int)));
connect(d->mkdirProc.data(), SIGNAL(outputAvailable(QByteArray)),
SLOT(handleStdOutData(QByteArray)));
connect(d->mkdirProc.data(), SIGNAL(errorOutputAvailable(QByteArray)),
SLOT(handleStdErrData(QByteArray)));
connect(d->mkdirProc.data(), SIGNAL(readyReadStandardOutput()), SLOT(handleStdOutData()));
connect(d->mkdirProc.data(), SIGNAL(readyReadStandardError()), SLOT(handleStdErrData()));
emit progressMessage(tr("Uploading file '%1'...")
.arg(QDir::toNativeSeparators(df.localFilePath)));
d->mkdirProc->start();
......
......@@ -69,8 +69,8 @@ private slots:
void handleUploadFinished(Utils::SftpJobId jobId, const QString &errorMsg);
void handleMkdirFinished(int exitStatus);
void handleLnFinished(int exitStatus);
void handleStdOutData(const QByteArray &data);
void handleStdErrData(const QByteArray &data);
void handleStdOutData();
void handleStdErrData();
private:
void checkDeploymentNeeded(const DeployableFile &file) const;
......
......@@ -57,8 +57,6 @@ public:
SshConnection::Ptr connection;
SshRemoteProcess::Ptr process;
RemoteLinuxUsedPortsGatherer portsGatherer;
QByteArray remoteStdout;
QByteArray remoteStderr;
State state;
};
......@@ -127,10 +125,6 @@ void GenericLinuxDeviceTester::handleConnected()
QTC_ASSERT(d->state == Connecting, return);
d->process = d->connection->createRemoteProcess("uname -rsm");
connect(d->process.data(), SIGNAL(outputAvailable(QByteArray)),
SLOT(handleRemoteStdOut(QByteArray)));
connect(d->process.data(), SIGNAL(errorOutputAvailable(QByteArray)),
SLOT(handleRemoteStdErr(QByteArray)));
connect(d->process.data(), SIGNAL(closed(int)), SLOT(handleProcessFinished(int)));
emit progressMessage("Checking kernel version...");
......@@ -146,31 +140,18 @@ void GenericLinuxDeviceTester::handleConnectionFailure()
setFinished(TestFailure);
}
void GenericLinuxDeviceTester::handleRemoteStdOut(const QByteArray &data)
{
QTC_ASSERT(d->state == RunningUname, return);
d->remoteStdout += data;
}
void GenericLinuxDeviceTester::handleRemoteStdErr(const QByteArray &data)
{
QTC_ASSERT(d->state == RunningUname, return);
d->remoteStderr += data;
}
void GenericLinuxDeviceTester::handleProcessFinished(int exitStatus)
{
QTC_ASSERT(d->state == RunningUname, return);
if (exitStatus != SshRemoteProcess::ExitedNormally || d->process->exitCode() != 0) {
if (!d->remoteStderr.isEmpty())
emit errorMessage(tr("uname failed: %1\n").arg(QString::fromUtf8(d->remoteStderr)));
const QByteArray stderrOutput = d->process->readAllStandardError();
if (!stderrOutput.isEmpty())
emit errorMessage(tr("uname failed: %1\n").arg(QString::fromUtf8(stderrOutput)));
else
emit errorMessage(tr("uname failed.\n"));
} else {
emit progressMessage(QString::fromUtf8(d->remoteStdout));
emit progressMessage(QString::fromUtf8(d->process->readAllStandardOutput()));
}
connect(&d->portsGatherer, SIGNAL(error(QString)), SLOT(handlePortsGatheringError(QString)));
......@@ -209,8 +190,6 @@ void GenericLinuxDeviceTester::handlePortListReady()
void GenericLinuxDeviceTester::setFinished(TestResult result)
{
d->state = Inactive;
d->remoteStdout.clear();
d->remoteStderr.clear();
disconnect(d->connection.data(), 0, this, 0);
disconnect(&d->portsGatherer, 0, this, 0);
emit finished(result);
......
......@@ -85,8 +85,6 @@ public:
private slots:
void handleConnected();
void handleConnectionFailure();
void handleRemoteStdOut(const QByteArray &data);
void handleRemoteStdErr(const QByteArray &data);
void handleProcessFinished(int exitStatus);
void handlePortsGatheringError(const QString &message);
void handlePortListReady();
......
......@@ -271,10 +271,8 @@ void AbstractRemoteLinuxApplicationRunner::startExecution(const QByteArray &remo
d->runner = d->connection->createRemoteProcess(remoteCall);
connect(d->runner.data(), SIGNAL(started()), SLOT(handleRemoteProcessStarted()));
connect(d->runner.data(), SIGNAL(closed(int)), SLOT(handleRemoteProcessFinished(int)));
connect(d->runner.data(), SIGNAL(outputAvailable(QByteArray)),
SIGNAL(remoteOutput(QByteArray)));
connect(d->runner.data(), SIGNAL(errorOutputAvailable(QByteArray)),
SIGNAL(remoteErrorOutput(QByteArray)));
connect(d->runner.data(), SIGNAL(readyReadStandardOutput()), SLOT(handleRemoteStdout()));
connect(d->runner.data(), SIGNAL(readyReadStandardError()), SLOT(handleRemoteStderr()));
d->state = ProcessStarting;
d->runner->start();
}
......@@ -357,6 +355,16 @@ void AbstractRemoteLinuxApplicationRunner::handleUsedPortsAvailable()
doAdditionalInitializations();
}
void AbstractRemoteLinuxApplicationRunner::handleRemoteStdout()
{
emit remoteOutput(d->runner->readAllStandardOutput());
}
void AbstractRemoteLinuxApplicationRunner::handleRemoteStderr()
{
emit remoteErrorOutput(d->runner->readAllStandardError());
}
bool AbstractRemoteLinuxApplicationRunner::canRun(QString &whyNot) const
{
if (d->remoteExecutable.isEmpty()) {
......
......@@ -102,6 +102,8 @@ private slots:
void handleRemoteProcessFinished(int exitStatus);
void handlePortsGathererError(const QString &errorMsg);
void handleUsedPortsAvailable();
void handleRemoteStdout();
void handleRemoteStderr();
private:
......
......@@ -218,8 +218,8 @@ void CallgrindController::getLocalDataFile()
// if there are files like callgrind.out.PID.NUM, set it to the most recent one of those
QString cmd = QString("ls -t %1* | head -n 1").arg(fileName);
m_findRemoteFile = m_ssh->createRemoteProcess(cmd.toUtf8());
connect(m_findRemoteFile.data(), SIGNAL(outputAvailable(QByteArray)),
this, SLOT(foundRemoteFile(QByteArray)));
connect(m_findRemoteFile.data(), SIGNAL(readyReadStandardOutput()), this,
SLOT(foundRemoteFile()));
m_findRemoteFile->start();
} else {
QDir dir(workingDir, QString("%1.*").arg(baseFileName), QDir::Time);
......@@ -232,9 +232,9 @@ void CallgrindController::getLocalDataFile()
}
}
void CallgrindController::foundRemoteFile(const QByteArray &file)
void CallgrindController::foundRemoteFile()
{
m_remoteFile = file.trimmed();
m_remoteFile = m_findRemoteFile->readAllStandardOutput().trimmed();
m_sftp = m_ssh->createSftpChannel();
connect(m_sftp.data(), SIGNAL(finished(Utils::SftpJobId,QString)),
......
......@@ -87,7 +87,7 @@ private Q_SLOTS:
void processError(QProcess::ProcessError);
void processFinished(int, QProcess::ExitStatus);
void foundRemoteFile(const QByteArray &file);
void foundRemoteFile();
void sftpInitialized();
void sftpJobFinished(Utils::SftpJobId job, const QString &error);
......
......@@ -210,10 +210,8 @@ void RemoteValgrindProcess::connected()
cmd += m_valgrindExe + ' ' + arguments;
m_process = m_connection->createRemoteProcess(cmd.toUtf8());
connect(m_process.data(), SIGNAL(errorOutputAvailable(QByteArray)),
this, SLOT(standardError(QByteArray)));
connect(m_process.data(), SIGNAL(outputAvailable(QByteArray)),
this, SLOT(standardOutput(QByteArray)));
connect(m_process.data(), SIGNAL(readyReadStandardError()), this, SLOT(standardError()));
connect(m_process.data(), SIGNAL(readyReadStandardOutput()), this, SLOT(standardOutput()));
connect(m_process.data(), SIGNAL(closed(int)),
this, SLOT(closed(int)));
connect(m_process.data(), SIGNAL(started()),
......@@ -250,17 +248,15 @@ void RemoteValgrindProcess::processStarted()
).arg(proc, QFileInfo(m_debuggee).fileName());
m_findPID = m_connection->createRemoteProcess(cmd.toUtf8());
connect(m_findPID.data(), SIGNAL(errorOutputAvailable(QByteArray)),
this, SLOT(standardOutput(QByteArray)));
connect(m_findPID.data(), SIGNAL(outputAvailable(QByteArray)),
this, SLOT(findPIDOutputReceived(QByteArray)));
connect(m_findPID.data(), SIGNAL(readyReadStandardError()), this, SLOT(standardError()));
connect(m_findPID.data(), SIGNAL(readyReadStandardOutput()), SLOT(findPIDOutputReceived()));
m_findPID->start();
}
void RemoteValgrindProcess::findPIDOutputReceived(const QByteArray &output)
void RemoteValgrindProcess::findPIDOutputReceived()
{
bool ok;
m_pid = output.trimmed().toLongLong(&ok);
m_pid = m_findPID->readAllStandardOutput().trimmed().toLongLong(&ok);
if (!ok) {
m_pid = 0;
m_errorString = tr("Could not determine remote PID.");
......@@ -272,14 +268,14 @@ void RemoteValgrindProcess::findPIDOutputReceived(const QByteArray &output)
}
}
void RemoteValgrindProcess::standardOutput(const QByteArray &output)
void RemoteValgrindProcess::standardOutput()
{
emit processOutput(output, Utils::StdOutFormat);
emit processOutput(m_process->readAllStandardOutput(), Utils::StdOutFormat);
}
void RemoteValgrindProcess::standardError(const QByteArray &output)
void RemoteValgrindProcess::standardError()
{
emit processOutput(output, Utils::StdErrFormat);
emit processOutput(m_process->readAllStandardError(), Utils::StdErrFormat);
}
void RemoteValgrindProcess::error(Utils::SshError error)
......
......@@ -146,9 +146,9 @@ private slots:
void connected();
void error(Utils::SshError error);
void processStarted();
void findPIDOutputReceived(const QByteArray &output);
void standardOutput(const QByteArray &output);
void standardError(const QByteArray &output);
void findPIDOutputReceived();
void standardOutput();
void standardError();
private:
Utils::SshConnectionParameters m_params;
......
......@@ -83,10 +83,8 @@ void Shell::handleConnected()
{
m_shell = m_connection->createRemoteShell();
connect(m_shell.data(), SIGNAL(started()), SLOT(handleShellStarted()));
connect(m_shell.data(), SIGNAL(outputAvailable(QByteArray)),
SLOT(handleRemoteStdout(QByteArray)));
connect(m_shell.data(), SIGNAL(errorOutputAvailable(QByteArray)),
SLOT(handleRemoteStderr(QByteArray)));
connect(m_shell.data(), SIGNAL(readyReadStandardOutput()), SLOT(handleRemoteStdout()));
connect(m_shell.data(), SIGNAL(readyReadStandardError()), SLOT(handleRemoteStderr()));
connect(m_shell.data(), SIGNAL(closed(int)), SLOT(handleChannelClosed(int)));