forked from qt-creator/qt-creator
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:
@@ -62,6 +62,8 @@ public:
|
|||||||
QString m_lastConnectionErrorString;
|
QString m_lastConnectionErrorString;
|
||||||
SshRemoteProcess::ExitStatus m_exitStatus;
|
SshRemoteProcess::ExitStatus m_exitStatus;
|
||||||
SshRemoteProcess::Signal m_exitSignal;
|
SshRemoteProcess::Signal m_exitSignal;
|
||||||
|
QByteArray m_stdout;
|
||||||
|
QByteArray m_stderr;
|
||||||
int m_exitCode;
|
int m_exitCode;
|
||||||
QString m_processErrorString;
|
QString m_processErrorString;
|
||||||
State m_state;
|
State m_state;
|
||||||
@@ -187,12 +189,14 @@ void SshRemoteProcessRunner::handleProcessFinished(int exitStatus)
|
|||||||
|
|
||||||
void SshRemoteProcessRunner::handleStdout()
|
void SshRemoteProcessRunner::handleStdout()
|
||||||
{
|
{
|
||||||
emit processOutputAvailable(d->m_process->readAllStandardOutput());
|
d->m_stdout += d->m_process->readAllStandardOutput();
|
||||||
|
emit readyReadStandardOutput();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SshRemoteProcessRunner::handleStderr()
|
void SshRemoteProcessRunner::handleStderr()
|
||||||
{
|
{
|
||||||
emit processErrorOutputAvailable(d->m_process->readAllStandardError());
|
d->m_stderr += d->m_process->readAllStandardError();
|
||||||
|
emit readyReadStandardError();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SshRemoteProcessRunner::setState(int newState)
|
void SshRemoteProcessRunner::setState(int newState)
|
||||||
@@ -249,6 +253,20 @@ QString SshRemoteProcessRunner::processErrorString() const
|
|||||||
return d->m_processErrorString;
|
return d->m_processErrorString;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QByteArray SshRemoteProcessRunner::readAllStandardOutput()
|
||||||
|
{
|
||||||
|
const QByteArray data = d->m_stdout;
|
||||||
|
d->m_stdout.clear();
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
QByteArray SshRemoteProcessRunner::readAllStandardError()
|
||||||
|
{
|
||||||
|
const QByteArray data = d->m_stderr;
|
||||||
|
d->m_stderr.clear();
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
void SshRemoteProcessRunner::writeDataToProcess(const QByteArray &data)
|
void SshRemoteProcessRunner::writeDataToProcess(const QByteArray &data)
|
||||||
{
|
{
|
||||||
QSSH_ASSERT(isProcessRunning());
|
QSSH_ASSERT(isProcessRunning());
|
||||||
|
|||||||
@@ -65,6 +65,15 @@ public:
|
|||||||
SshRemoteProcess::Signal processExitSignal() const;
|
SshRemoteProcess::Signal processExitSignal() const;
|
||||||
int processExitCode() const;
|
int processExitCode() const;
|
||||||
QString processErrorString() const;
|
QString processErrorString() const;
|
||||||
|
QByteArray readAllStandardOutput();
|
||||||
|
QByteArray readAllStandardError();
|
||||||
|
|
||||||
|
signals:
|
||||||
|
void connectionError();
|
||||||
|
void processStarted();
|
||||||
|
void readyReadStandardOutput();
|
||||||
|
void readyReadStandardError();
|
||||||
|
void processClosed(int exitStatus); // values are of type SshRemoteProcess::ExitStatus
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void handleConnected();
|
void handleConnected();
|
||||||
@@ -75,13 +84,6 @@ private slots:
|
|||||||
void handleStdout();
|
void handleStdout();
|
||||||
void handleStderr();
|
void handleStderr();
|
||||||
|
|
||||||
signals:
|
|
||||||
void connectionError();
|
|
||||||
void processStarted();
|
|
||||||
void processOutputAvailable(const QByteArray &output);
|
|
||||||
void processErrorOutputAvailable(const QByteArray &output);
|
|
||||||
void processClosed(int exitStatus); // values are of type SshRemoteProcess::ExitStatus
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void runInternal(const QByteArray &command, const QSsh::SshConnectionParameters &sshParams);
|
void runInternal(const QByteArray &command, const QSsh::SshConnectionParameters &sshParams);
|
||||||
void setState(int newState);
|
void setState(int newState);
|
||||||
|
|||||||
@@ -70,10 +70,8 @@ SshIODevice::SshIODevice(QSsh::SshRemoteProcessRunner *r)
|
|||||||
{
|
{
|
||||||
setOpenMode(QIODevice::ReadWrite | QIODevice::Unbuffered);
|
setOpenMode(QIODevice::ReadWrite | QIODevice::Unbuffered);
|
||||||
connect (runner, SIGNAL(processStarted()), this, SLOT(processStarted()));
|
connect (runner, SIGNAL(processStarted()), this, SLOT(processStarted()));
|
||||||
connect(runner, SIGNAL(processOutputAvailable(QByteArray)),
|
connect(runner, SIGNAL(readyReadStandardOutput()), this, SLOT(outputAvailable()));
|
||||||
this, SLOT(outputAvailable(QByteArray)));
|
connect(runner, SIGNAL(readyReadStandardError()), this, SLOT(errorOutputAvailable()));
|
||||||
connect(runner, SIGNAL(processErrorOutputAvailable(QByteArray)),
|
|
||||||
this, SLOT(errorOutputAvailable(QByteArray)));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
SshIODevice::~SshIODevice()
|
SshIODevice::~SshIODevice()
|
||||||
@@ -130,15 +128,15 @@ void SshIODevice::processStarted()
|
|||||||
runner->writeDataToProcess(startupbuffer);
|
runner->writeDataToProcess(startupbuffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SshIODevice::outputAvailable(const QByteArray &output)
|
void SshIODevice::outputAvailable()
|
||||||
{
|
{
|
||||||
buckets.enqueue(output);
|
buckets.enqueue(runner->readAllStandardOutput());
|
||||||
emit readyRead();
|
emit readyRead();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SshIODevice::errorOutputAvailable(const QByteArray &output)
|
void SshIODevice::errorOutputAvailable()
|
||||||
{
|
{
|
||||||
fprintf(stderr, "%s", output.data());
|
fprintf(stderr, "%s", runner->readAllStandardError().data());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -56,8 +56,8 @@ public:
|
|||||||
virtual qint64 readData (char * data, qint64 maxSize);
|
virtual qint64 readData (char * data, qint64 maxSize);
|
||||||
private slots:
|
private slots:
|
||||||
void processStarted();
|
void processStarted();
|
||||||
void outputAvailable(const QByteArray &output);
|
void outputAvailable();
|
||||||
void errorOutputAvailable(const QByteArray &output);
|
void errorOutputAvailable();
|
||||||
private:
|
private:
|
||||||
QSsh::SshRemoteProcessRunner *runner;
|
QSsh::SshRemoteProcessRunner *runner;
|
||||||
QSsh::SshRemoteProcess::Ptr proc;
|
QSsh::SshRemoteProcess::Ptr proc;
|
||||||
|
|||||||
@@ -110,10 +110,6 @@ void MaddeDeviceTester::handleGenericTestFinished(TestResult result)
|
|||||||
if (!m_processRunner)
|
if (!m_processRunner)
|
||||||
m_processRunner = new SshRemoteProcessRunner(this);
|
m_processRunner = new SshRemoteProcessRunner(this);
|
||||||
connect(m_processRunner, SIGNAL(connectionError()), SLOT(handleConnectionError()));
|
connect(m_processRunner, SIGNAL(connectionError()), SLOT(handleConnectionError()));
|
||||||
connect(m_processRunner, SIGNAL(processOutputAvailable(QByteArray)),
|
|
||||||
SLOT(handleStdout(QByteArray)));
|
|
||||||
connect(m_processRunner, SIGNAL(processErrorOutputAvailable(QByteArray)),
|
|
||||||
SLOT(handleStderr(QByteArray)));
|
|
||||||
connect(m_processRunner, SIGNAL(processClosed(int)), SLOT(handleProcessFinished(int)));
|
connect(m_processRunner, SIGNAL(processClosed(int)), SLOT(handleProcessFinished(int)));
|
||||||
|
|
||||||
QString qtInfoCmd;
|
QString qtInfoCmd;
|
||||||
@@ -125,8 +121,6 @@ void MaddeDeviceTester::handleGenericTestFinished(TestResult result)
|
|||||||
}
|
}
|
||||||
|
|
||||||
emit progressMessage(tr("Checking for Qt libraries..."));
|
emit progressMessage(tr("Checking for Qt libraries..."));
|
||||||
m_stdout.clear();
|
|
||||||
m_stderr.clear();
|
|
||||||
m_state = QtTest;
|
m_state = QtTest;
|
||||||
m_processRunner->run(qtInfoCmd.toUtf8(), m_deviceConfiguration->sshParameters());
|
m_processRunner->run(qtInfoCmd.toUtf8(), m_deviceConfiguration->sshParameters());
|
||||||
}
|
}
|
||||||
@@ -141,22 +135,6 @@ void MaddeDeviceTester::handleConnectionError()
|
|||||||
setFinished();
|
setFinished();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MaddeDeviceTester::handleStdout(const QByteArray &data)
|
|
||||||
{
|
|
||||||
QTC_ASSERT(m_state == QtTest || m_state == MadDeveloperTest || m_state == QmlToolingTest,
|
|
||||||
return);
|
|
||||||
|
|
||||||
m_stdout += data;
|
|
||||||
}
|
|
||||||
|
|
||||||
void MaddeDeviceTester::handleStderr(const QByteArray &data)
|
|
||||||
{
|
|
||||||
QTC_ASSERT(m_state == QtTest || m_state == MadDeveloperTest || m_state == QmlToolingTest,
|
|
||||||
return);
|
|
||||||
|
|
||||||
m_stderr += data;
|
|
||||||
}
|
|
||||||
|
|
||||||
void MaddeDeviceTester::handleProcessFinished(int exitStatus)
|
void MaddeDeviceTester::handleProcessFinished(int exitStatus)
|
||||||
{
|
{
|
||||||
switch (m_state) {
|
switch (m_state) {
|
||||||
@@ -178,9 +156,10 @@ void MaddeDeviceTester::handleQtTestFinished(int exitStatus)
|
|||||||
{
|
{
|
||||||
if (exitStatus != SshRemoteProcess::NormalExit
|
if (exitStatus != SshRemoteProcess::NormalExit
|
||||||
|| m_processRunner->processExitCode() != 0) {
|
|| m_processRunner->processExitCode() != 0) {
|
||||||
if (!m_stderr.isEmpty()) {
|
const QByteArray stdErr = m_processRunner->readAllStandardError();
|
||||||
|
if (!stdErr.isEmpty()) {
|
||||||
emit errorMessage(tr("Error checking for Qt libraries: %1\n")
|
emit errorMessage(tr("Error checking for Qt libraries: %1\n")
|
||||||
.arg(QString::fromUtf8(m_stderr)));
|
.arg(QString::fromUtf8(stdErr)));
|
||||||
} else {
|
} else {
|
||||||
emit errorMessage(tr("Error checking for Qt libraries.\n"));
|
emit errorMessage(tr("Error checking for Qt libraries.\n"));
|
||||||
}
|
}
|
||||||
@@ -190,9 +169,6 @@ void MaddeDeviceTester::handleQtTestFinished(int exitStatus)
|
|||||||
emit progressMessage(processedQtLibsList());
|
emit progressMessage(processedQtLibsList());
|
||||||
}
|
}
|
||||||
|
|
||||||
m_stdout.clear();
|
|
||||||
m_stderr.clear();
|
|
||||||
|
|
||||||
emit progressMessage(tr("Checking for connectivity support..."));
|
emit progressMessage(tr("Checking for connectivity support..."));
|
||||||
m_state = MadDeveloperTest;
|
m_state = MadDeveloperTest;
|
||||||
m_processRunner->run(QString(QLatin1String("test -x") + MaemoGlobal::devrootshPath()).toUtf8(),
|
m_processRunner->run(QString(QLatin1String("test -x") + MaemoGlobal::devrootshPath()).toUtf8(),
|
||||||
@@ -202,9 +178,10 @@ void MaddeDeviceTester::handleQtTestFinished(int exitStatus)
|
|||||||
void MaddeDeviceTester::handleMadDeveloperTestFinished(int exitStatus)
|
void MaddeDeviceTester::handleMadDeveloperTestFinished(int exitStatus)
|
||||||
{
|
{
|
||||||
if (exitStatus != SshRemoteProcess::NormalExit) {
|
if (exitStatus != SshRemoteProcess::NormalExit) {
|
||||||
if (!m_stderr.isEmpty()) {
|
const QByteArray stdErr = m_processRunner->readAllStandardError();
|
||||||
|
if (!stdErr.isEmpty()) {
|
||||||
emit errorMessage(tr("Error checking for connectivity tool: %1\n")
|
emit errorMessage(tr("Error checking for connectivity tool: %1\n")
|
||||||
.arg(QString::fromUtf8(m_stderr)));
|
.arg(QString::fromUtf8(stdErr)));
|
||||||
} else {
|
} else {
|
||||||
emit errorMessage(tr("Error checking for connectivity tool.\n"));
|
emit errorMessage(tr("Error checking for connectivity tool.\n"));
|
||||||
}
|
}
|
||||||
@@ -227,9 +204,6 @@ void MaddeDeviceTester::handleMadDeveloperTestFinished(int exitStatus)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_stdout.clear();
|
|
||||||
m_stderr.clear();
|
|
||||||
|
|
||||||
emit progressMessage(tr("Checking for QML tooling support..."));
|
emit progressMessage(tr("Checking for QML tooling support..."));
|
||||||
m_state = QmlToolingTest;
|
m_state = QmlToolingTest;
|
||||||
m_processRunner->run(QString(QLatin1String("test -d ")
|
m_processRunner->run(QString(QLatin1String("test -d ")
|
||||||
@@ -239,9 +213,10 @@ void MaddeDeviceTester::handleMadDeveloperTestFinished(int exitStatus)
|
|||||||
void MaddeDeviceTester::handleQmlToolingTestFinished(int exitStatus)
|
void MaddeDeviceTester::handleQmlToolingTestFinished(int exitStatus)
|
||||||
{
|
{
|
||||||
if (exitStatus != SshRemoteProcess::NormalExit) {
|
if (exitStatus != SshRemoteProcess::NormalExit) {
|
||||||
if (!m_stderr.isEmpty()) {
|
const QByteArray stdErr = m_processRunner->readAllStandardError();
|
||||||
|
if (!stdErr.isEmpty()) {
|
||||||
emit errorMessage(tr("Error checking for QML tooling support: %1\n")
|
emit errorMessage(tr("Error checking for QML tooling support: %1\n")
|
||||||
.arg(QString::fromUtf8(m_stderr)));
|
.arg(QString::fromUtf8(stdErr)));
|
||||||
} else {
|
} else {
|
||||||
emit errorMessage(tr("Error checking for QML tooling support.\n"));
|
emit errorMessage(tr("Error checking for QML tooling support.\n"));
|
||||||
}
|
}
|
||||||
@@ -259,7 +234,7 @@ void MaddeDeviceTester::handleQmlToolingTestFinished(int exitStatus)
|
|||||||
|
|
||||||
QString MaddeDeviceTester::processedQtLibsList()
|
QString MaddeDeviceTester::processedQtLibsList()
|
||||||
{
|
{
|
||||||
QString unfilteredLibs = QString::fromUtf8(m_stdout);
|
QString unfilteredLibs = QString::fromUtf8(m_processRunner->readAllStandardOutput());
|
||||||
QString filteredLibs;
|
QString filteredLibs;
|
||||||
QString patternString;
|
QString patternString;
|
||||||
if (m_deviceConfiguration->type() == Core::Id(MeeGoOsType))
|
if (m_deviceConfiguration->type() == Core::Id(MeeGoOsType))
|
||||||
|
|||||||
@@ -56,8 +56,6 @@ public:
|
|||||||
private slots:
|
private slots:
|
||||||
void handleGenericTestFinished(RemoteLinux::AbstractLinuxDeviceTester::TestResult result);
|
void handleGenericTestFinished(RemoteLinux::AbstractLinuxDeviceTester::TestResult result);
|
||||||
void handleConnectionError();
|
void handleConnectionError();
|
||||||
void handleStdout(const QByteArray &data);
|
|
||||||
void handleStderr(const QByteArray &data);
|
|
||||||
void handleProcessFinished(int exitStatus);
|
void handleProcessFinished(int exitStatus);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@@ -75,8 +73,6 @@ private:
|
|||||||
TestResult m_result;
|
TestResult m_result;
|
||||||
QSsh::SshRemoteProcessRunner *m_processRunner;
|
QSsh::SshRemoteProcessRunner *m_processRunner;
|
||||||
QSharedPointer<const RemoteLinux::LinuxDeviceConfiguration> m_deviceConfiguration;
|
QSharedPointer<const RemoteLinux::LinuxDeviceConfiguration> m_deviceConfiguration;
|
||||||
QByteArray m_stdout;
|
|
||||||
QByteArray m_stderr;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
|||||||
@@ -396,8 +396,7 @@ void MaemoPublisherFremantleFree::uploadPackage()
|
|||||||
connect(m_uploader, SIGNAL(processStarted()), SLOT(handleScpStarted()));
|
connect(m_uploader, SIGNAL(processStarted()), SLOT(handleScpStarted()));
|
||||||
connect(m_uploader, SIGNAL(connectionError()), SLOT(handleConnectionError()));
|
connect(m_uploader, SIGNAL(connectionError()), SLOT(handleConnectionError()));
|
||||||
connect(m_uploader, SIGNAL(processClosed(int)), SLOT(handleUploadJobFinished(int)));
|
connect(m_uploader, SIGNAL(processClosed(int)), SLOT(handleUploadJobFinished(int)));
|
||||||
connect(m_uploader, SIGNAL(processOutputAvailable(QByteArray)),
|
connect(m_uploader, SIGNAL(readyReadStandardOutput()), SLOT(handleScpStdOut()));
|
||||||
SLOT(handleScpStdOut(QByteArray)));
|
|
||||||
emit progressReport(tr("Starting scp..."));
|
emit progressReport(tr("Starting scp..."));
|
||||||
setState(StartingScp);
|
setState(StartingScp);
|
||||||
m_uploader->run("scp -td " + m_remoteDir.toUtf8(), m_sshParams);
|
m_uploader->run("scp -td " + m_remoteDir.toUtf8(), m_sshParams);
|
||||||
@@ -488,7 +487,7 @@ void MaemoPublisherFremantleFree::sendFile()
|
|||||||
m_uploader->writeDataToProcess(QByteArray(1, '\0'));
|
m_uploader->writeDataToProcess(QByteArray(1, '\0'));
|
||||||
}
|
}
|
||||||
|
|
||||||
void MaemoPublisherFremantleFree::handleScpStdOut(const QByteArray &output)
|
void MaemoPublisherFremantleFree::handleScpStdOut()
|
||||||
{
|
{
|
||||||
QTC_ASSERT(m_state == PreparingToUploadFile || m_state == UploadingFile || m_state == Inactive,
|
QTC_ASSERT(m_state == PreparingToUploadFile || m_state == UploadingFile || m_state == Inactive,
|
||||||
return);
|
return);
|
||||||
@@ -496,7 +495,7 @@ void MaemoPublisherFremantleFree::handleScpStdOut(const QByteArray &output)
|
|||||||
if (m_state == Inactive)
|
if (m_state == Inactive)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
m_scpOutput += output;
|
m_scpOutput += m_uploader->readAllStandardOutput();
|
||||||
if (m_scpOutput == QByteArray(1, '\0')) {
|
if (m_scpOutput == QByteArray(1, '\0')) {
|
||||||
m_scpOutput.clear();
|
m_scpOutput.clear();
|
||||||
switch (m_state) {
|
switch (m_state) {
|
||||||
|
|||||||
@@ -87,7 +87,7 @@ private slots:
|
|||||||
void handleScpStarted();
|
void handleScpStarted();
|
||||||
void handleConnectionError();
|
void handleConnectionError();
|
||||||
void handleUploadJobFinished(int exitStatus);
|
void handleUploadJobFinished(int exitStatus);
|
||||||
void handleScpStdOut(const QByteArray &output);
|
void handleScpStdOut();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
enum State {
|
enum State {
|
||||||
|
|||||||
@@ -66,10 +66,8 @@ void MaemoRemoteCopyFacility::copyFiles(SshConnection *connection,
|
|||||||
if (!m_copyRunner)
|
if (!m_copyRunner)
|
||||||
m_copyRunner = new SshRemoteProcessRunner(this);
|
m_copyRunner = new SshRemoteProcessRunner(this);
|
||||||
connect(m_copyRunner, SIGNAL(connectionError()), SLOT(handleConnectionError()));
|
connect(m_copyRunner, SIGNAL(connectionError()), SLOT(handleConnectionError()));
|
||||||
connect(m_copyRunner, SIGNAL(processOutputAvailable(QByteArray)),
|
connect(m_copyRunner, SIGNAL(readyReadStandardOutput()), SLOT(handleRemoteStdout()));
|
||||||
SLOT(handleRemoteStdout(QByteArray)));
|
connect(m_copyRunner, SIGNAL(readyReadStandardError()), SLOT(handleRemoteStderr()));
|
||||||
connect(m_copyRunner, SIGNAL(processErrorOutputAvailable(QByteArray)),
|
|
||||||
SLOT(handleRemoteStderr(QByteArray)));
|
|
||||||
connect(m_copyRunner, SIGNAL(processClosed(int)), SLOT(handleCopyFinished(int)));
|
connect(m_copyRunner, SIGNAL(processClosed(int)), SLOT(handleCopyFinished(int)));
|
||||||
|
|
||||||
m_isCopying = true;
|
m_isCopying = true;
|
||||||
@@ -92,14 +90,14 @@ void MaemoRemoteCopyFacility::handleConnectionError()
|
|||||||
emit finished(tr("Connection failed: %1").arg(m_copyRunner->lastConnectionErrorString()));
|
emit finished(tr("Connection failed: %1").arg(m_copyRunner->lastConnectionErrorString()));
|
||||||
}
|
}
|
||||||
|
|
||||||
void MaemoRemoteCopyFacility::handleRemoteStdout(const QByteArray &output)
|
void MaemoRemoteCopyFacility::handleRemoteStdout()
|
||||||
{
|
{
|
||||||
emit stdoutData(QString::fromUtf8(output));
|
emit stdoutData(QString::fromUtf8(m_copyRunner->readAllStandardOutput()));
|
||||||
}
|
}
|
||||||
|
|
||||||
void MaemoRemoteCopyFacility::handleRemoteStderr(const QByteArray &output)
|
void MaemoRemoteCopyFacility::handleRemoteStderr()
|
||||||
{
|
{
|
||||||
emit stderrData(QString::fromUtf8(output));
|
emit stderrData(QString::fromUtf8(m_copyRunner->readAllStandardError()));
|
||||||
}
|
}
|
||||||
|
|
||||||
void MaemoRemoteCopyFacility::handleCopyFinished(int exitStatus)
|
void MaemoRemoteCopyFacility::handleCopyFinished(int exitStatus)
|
||||||
|
|||||||
@@ -74,8 +74,8 @@ signals:
|
|||||||
private slots:
|
private slots:
|
||||||
void handleConnectionError();
|
void handleConnectionError();
|
||||||
void handleCopyFinished(int exitStatus);
|
void handleCopyFinished(int exitStatus);
|
||||||
void handleRemoteStdout(const QByteArray &output);
|
void handleRemoteStdout();
|
||||||
void handleRemoteStderr(const QByteArray &output);
|
void handleRemoteStderr();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void copyNextFile();
|
void copyNextFile();
|
||||||
|
|||||||
@@ -46,7 +46,6 @@ public:
|
|||||||
QString pathToCheck;
|
QString pathToCheck;
|
||||||
quint64 requiredSpaceInBytes;
|
quint64 requiredSpaceInBytes;
|
||||||
QSsh::SshRemoteProcessRunner *processRunner;
|
QSsh::SshRemoteProcessRunner *processRunner;
|
||||||
QByteArray processOutput;
|
|
||||||
};
|
};
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
|
||||||
@@ -74,14 +73,9 @@ void RemoteLinuxCheckForFreeDiskSpaceService::setRequiredSpaceInBytes(quint64 si
|
|||||||
d->requiredSpaceInBytes = sizeInBytes;
|
d->requiredSpaceInBytes = sizeInBytes;
|
||||||
}
|
}
|
||||||
|
|
||||||
void RemoteLinuxCheckForFreeDiskSpaceService::handleStdOut(const QByteArray &output)
|
void RemoteLinuxCheckForFreeDiskSpaceService::handleStdErr()
|
||||||
{
|
{
|
||||||
d->processOutput += output;
|
emit stdErrData(QString::fromUtf8(d->processRunner->readAllStandardError()));
|
||||||
}
|
|
||||||
|
|
||||||
void RemoteLinuxCheckForFreeDiskSpaceService::handleStdErr(const QByteArray &output)
|
|
||||||
{
|
|
||||||
emit stdErrData(QString::fromUtf8(output));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void RemoteLinuxCheckForFreeDiskSpaceService::handleProcessFinished()
|
void RemoteLinuxCheckForFreeDiskSpaceService::handleProcessFinished()
|
||||||
@@ -100,11 +94,12 @@ void RemoteLinuxCheckForFreeDiskSpaceService::handleProcessFinished()
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool isNumber;
|
bool isNumber;
|
||||||
d->processOutput.chop(1); // newline
|
QByteArray processOutput = d->processRunner->readAllStandardOutput();
|
||||||
quint64 freeSpace = d->processOutput.toULongLong(&isNumber);
|
processOutput.chop(1); // newline
|
||||||
|
quint64 freeSpace = processOutput.toULongLong(&isNumber);
|
||||||
if (!isNumber) {
|
if (!isNumber) {
|
||||||
emit errorMessage(tr("Unexpected output from remote process: '%1'.")
|
emit errorMessage(tr("Unexpected output from remote process: '%1'.")
|
||||||
.arg(QString::fromUtf8(d->processOutput)));
|
.arg(QString::fromUtf8(processOutput)));
|
||||||
stopDeployment();
|
stopDeployment();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -140,10 +135,7 @@ void RemoteLinuxCheckForFreeDiskSpaceService::doDeploy()
|
|||||||
{
|
{
|
||||||
d->processRunner = new QSsh::SshRemoteProcessRunner;
|
d->processRunner = new QSsh::SshRemoteProcessRunner;
|
||||||
connect(d->processRunner, SIGNAL(processClosed(int)), SLOT(handleProcessFinished()));
|
connect(d->processRunner, SIGNAL(processClosed(int)), SLOT(handleProcessFinished()));
|
||||||
connect(d->processRunner, SIGNAL(processOutputAvailable(QByteArray)),
|
connect(d->processRunner, SIGNAL(readyReadStandardError()), SLOT(handleStdErr()));
|
||||||
SLOT(handleStdOut(QByteArray)));
|
|
||||||
connect(d->processRunner, SIGNAL(processErrorOutputAvailable(QByteArray)),
|
|
||||||
SLOT(handleStdErr(QByteArray)));
|
|
||||||
const QString command = QString::fromLocal8Bit("df -k -P %1 |tail -n 1 |sed 's/ */ /g' "
|
const QString command = QString::fromLocal8Bit("df -k -P %1 |tail -n 1 |sed 's/ */ /g' "
|
||||||
"|cut -d ' ' -f 4").arg(d->pathToCheck);
|
"|cut -d ' ' -f 4").arg(d->pathToCheck);
|
||||||
d->processRunner->run(command.toUtf8(), deviceConfiguration()->sshParameters());
|
d->processRunner->run(command.toUtf8(), deviceConfiguration()->sshParameters());
|
||||||
@@ -163,7 +155,6 @@ void RemoteLinuxCheckForFreeDiskSpaceService::cleanup()
|
|||||||
delete d->processRunner;
|
delete d->processRunner;
|
||||||
d->processRunner = 0;
|
d->processRunner = 0;
|
||||||
}
|
}
|
||||||
d->processOutput.clear();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace RemoteLinux
|
} // namespace RemoteLinux
|
||||||
|
|||||||
@@ -48,8 +48,7 @@ public:
|
|||||||
void setRequiredSpaceInBytes(quint64 sizeInBytes);
|
void setRequiredSpaceInBytes(quint64 sizeInBytes);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void handleStdOut(const QByteArray &output);
|
void handleStdErr();
|
||||||
void handleStdErr(const QByteArray &output);
|
|
||||||
void handleProcessFinished();
|
void handleProcessFinished();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|||||||
@@ -99,10 +99,8 @@ void RemoteLinuxCustomCommandDeployService::doDeploy()
|
|||||||
|
|
||||||
if (!d->runner)
|
if (!d->runner)
|
||||||
d->runner = new SshRemoteProcessRunner(this);
|
d->runner = new SshRemoteProcessRunner(this);
|
||||||
connect(d->runner, SIGNAL(processOutputAvailable(QByteArray)),
|
connect(d->runner, SIGNAL(readyReadStandardOutput()), SLOT(handleStdout()));
|
||||||
SLOT(handleStdout(QByteArray)));
|
connect(d->runner, SIGNAL(readyReadStandardError()), SLOT(handleStderr()));
|
||||||
connect(d->runner, SIGNAL(processErrorOutputAvailable(QByteArray)),
|
|
||||||
SLOT(handleStderr(QByteArray)));
|
|
||||||
connect(d->runner, SIGNAL(processClosed(int)), SLOT(handleProcessClosed(int)));
|
connect(d->runner, SIGNAL(processClosed(int)), SLOT(handleProcessClosed(int)));
|
||||||
|
|
||||||
emit progressMessage(tr("Starting remote command '%1'...").arg(d->commandLine));
|
emit progressMessage(tr("Starting remote command '%1'...").arg(d->commandLine));
|
||||||
@@ -120,14 +118,14 @@ void RemoteLinuxCustomCommandDeployService::stopDeployment()
|
|||||||
handleDeploymentDone();
|
handleDeploymentDone();
|
||||||
}
|
}
|
||||||
|
|
||||||
void RemoteLinuxCustomCommandDeployService::handleStdout(const QByteArray &output)
|
void RemoteLinuxCustomCommandDeployService::handleStdout()
|
||||||
{
|
{
|
||||||
emit stdOutData(QString::fromUtf8(output));
|
emit stdOutData(QString::fromUtf8(d->runner->readAllStandardOutput()));
|
||||||
}
|
}
|
||||||
|
|
||||||
void RemoteLinuxCustomCommandDeployService::handleStderr(const QByteArray &output)
|
void RemoteLinuxCustomCommandDeployService::handleStderr()
|
||||||
{
|
{
|
||||||
emit stdErrData(QString::fromUtf8(output));
|
emit stdErrData(QString::fromUtf8(d->runner->readAllStandardError()));
|
||||||
}
|
}
|
||||||
|
|
||||||
void RemoteLinuxCustomCommandDeployService::handleProcessClosed(int exitStatus)
|
void RemoteLinuxCustomCommandDeployService::handleProcessClosed(int exitStatus)
|
||||||
|
|||||||
@@ -59,8 +59,8 @@ protected:
|
|||||||
void stopDeployment();
|
void stopDeployment();
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void handleStdout(const QByteArray &output);
|
void handleStdout();
|
||||||
void handleStderr(const QByteArray &output);
|
void handleStderr();
|
||||||
void handleProcessClosed(int exitStatus);
|
void handleProcessClosed(int exitStatus);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|||||||
@@ -63,13 +63,8 @@ void RemoteLinuxEnvironmentReader::start(const QString &environmentSetupCommand)
|
|||||||
m_remoteProcessRunner = new QSsh::SshRemoteProcessRunner(this);
|
m_remoteProcessRunner = new QSsh::SshRemoteProcessRunner(this);
|
||||||
connect(m_remoteProcessRunner, SIGNAL(connectionError()), SLOT(handleConnectionFailure()));
|
connect(m_remoteProcessRunner, SIGNAL(connectionError()), SLOT(handleConnectionFailure()));
|
||||||
connect(m_remoteProcessRunner, SIGNAL(processClosed(int)), SLOT(remoteProcessFinished(int)));
|
connect(m_remoteProcessRunner, SIGNAL(processClosed(int)), SLOT(remoteProcessFinished(int)));
|
||||||
connect(m_remoteProcessRunner, SIGNAL(processOutputAvailable(QByteArray)),
|
|
||||||
SLOT(remoteOutput(QByteArray)));
|
|
||||||
connect(m_remoteProcessRunner, SIGNAL(processErrorOutputAvailable(QByteArray)),
|
|
||||||
SLOT(remoteErrorOutput(QByteArray)));
|
|
||||||
const QByteArray remoteCall
|
const QByteArray remoteCall
|
||||||
= QString(environmentSetupCommand + QLatin1String("; env")).toUtf8();
|
= QString(environmentSetupCommand + QLatin1String("; env")).toUtf8();
|
||||||
m_remoteOutput.clear();
|
|
||||||
m_remoteProcessRunner->run(remoteCall, m_devConfig->sshParameters());
|
m_remoteProcessRunner->run(remoteCall, m_devConfig->sshParameters());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -112,32 +107,22 @@ void RemoteLinuxEnvironmentReader::remoteProcessFinished(int exitCode)
|
|||||||
disconnect(m_remoteProcessRunner, 0, this, 0);
|
disconnect(m_remoteProcessRunner, 0, this, 0);
|
||||||
m_env.clear();
|
m_env.clear();
|
||||||
if (exitCode == QSsh::SshRemoteProcess::NormalExit) {
|
if (exitCode == QSsh::SshRemoteProcess::NormalExit) {
|
||||||
if (!m_remoteOutput.isEmpty()) {
|
QString remoteOutput = QString::fromUtf8(m_remoteProcessRunner->readAllStandardOutput());
|
||||||
m_env = Utils::Environment(m_remoteOutput.split(QLatin1Char('\n'),
|
if (!remoteOutput.isEmpty()) {
|
||||||
|
m_env = Utils::Environment(remoteOutput.split(QLatin1Char('\n'),
|
||||||
QString::SkipEmptyParts));
|
QString::SkipEmptyParts));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
QString errorMsg = tr("Error running remote process: %1")
|
QString errorMsg = tr("Error running remote process: %1")
|
||||||
.arg(m_remoteProcessRunner->processErrorString());
|
.arg(m_remoteProcessRunner->processErrorString());
|
||||||
if (!m_remoteErrorOutput.isEmpty()) {
|
QString remoteStderr = m_remoteProcessRunner->readAllStandardError();
|
||||||
errorMsg += tr("\nRemote stderr was: '%1'")
|
if (!remoteStderr.isEmpty())
|
||||||
.arg(QString::fromUtf8(m_remoteErrorOutput));
|
errorMsg += tr("\nRemote stderr was: '%1'").arg(remoteStderr);
|
||||||
}
|
|
||||||
emit error(errorMsg);
|
emit error(errorMsg);
|
||||||
}
|
}
|
||||||
setFinished();
|
setFinished();
|
||||||
}
|
}
|
||||||
|
|
||||||
void RemoteLinuxEnvironmentReader::remoteOutput(const QByteArray &data)
|
|
||||||
{
|
|
||||||
m_remoteOutput.append(QString::fromUtf8(data));
|
|
||||||
}
|
|
||||||
|
|
||||||
void RemoteLinuxEnvironmentReader::remoteErrorOutput(const QByteArray &data)
|
|
||||||
{
|
|
||||||
m_remoteErrorOutput += data;
|
|
||||||
}
|
|
||||||
|
|
||||||
void RemoteLinuxEnvironmentReader::setFinished()
|
void RemoteLinuxEnvironmentReader::setFinished()
|
||||||
{
|
{
|
||||||
stop();
|
stop();
|
||||||
|
|||||||
@@ -68,15 +68,11 @@ private slots:
|
|||||||
void handleCurrentDeviceConfigChanged();
|
void handleCurrentDeviceConfigChanged();
|
||||||
|
|
||||||
void remoteProcessFinished(int exitCode);
|
void remoteProcessFinished(int exitCode);
|
||||||
void remoteOutput(const QByteArray &data);
|
|
||||||
void remoteErrorOutput(const QByteArray &data);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void setFinished();
|
void setFinished();
|
||||||
|
|
||||||
bool m_stop;
|
bool m_stop;
|
||||||
QString m_remoteOutput;
|
|
||||||
QByteArray m_remoteErrorOutput;
|
|
||||||
Utils::Environment m_env;
|
Utils::Environment m_env;
|
||||||
QSharedPointer<const LinuxDeviceConfiguration> m_devConfig;
|
QSharedPointer<const LinuxDeviceConfiguration> m_devConfig;
|
||||||
RemoteLinuxRunConfiguration *m_runConfig;
|
RemoteLinuxRunConfiguration *m_runConfig;
|
||||||
|
|||||||
@@ -76,10 +76,8 @@ void AbstractRemoteLinuxPackageInstaller::installPackage(const LinuxDeviceConfig
|
|||||||
if (!d->installer)
|
if (!d->installer)
|
||||||
d->installer = new SshRemoteProcessRunner(this);
|
d->installer = new SshRemoteProcessRunner(this);
|
||||||
connect(d->installer, SIGNAL(connectionError()), SLOT(handleConnectionError()));
|
connect(d->installer, SIGNAL(connectionError()), SLOT(handleConnectionError()));
|
||||||
connect(d->installer, SIGNAL(processOutputAvailable(QByteArray)),
|
connect(d->installer, SIGNAL(readyReadStandardOutput()), SLOT(handleInstallerOutput()));
|
||||||
SLOT(handleInstallerOutput(QByteArray)));
|
connect(d->installer, SIGNAL(readyReadStandardError()), SLOT(handleInstallerErrorOutput()));
|
||||||
connect(d->installer, SIGNAL(processErrorOutputAvailable(QByteArray)),
|
|
||||||
SLOT(handleInstallerErrorOutput(QByteArray)));
|
|
||||||
connect(d->installer, SIGNAL(processClosed(int)), SLOT(handleInstallationFinished(int)));
|
connect(d->installer, SIGNAL(processClosed(int)), SLOT(handleInstallationFinished(int)));
|
||||||
|
|
||||||
QString cmdLine = installCommandLine(packageFilePath);
|
QString cmdLine = installCommandLine(packageFilePath);
|
||||||
@@ -123,14 +121,14 @@ void AbstractRemoteLinuxPackageInstaller::handleInstallationFinished(int exitSta
|
|||||||
setFinished();
|
setFinished();
|
||||||
}
|
}
|
||||||
|
|
||||||
void AbstractRemoteLinuxPackageInstaller::handleInstallerOutput(const QByteArray &output)
|
void AbstractRemoteLinuxPackageInstaller::handleInstallerOutput()
|
||||||
{
|
{
|
||||||
emit stdoutData(QString::fromUtf8(output));
|
emit stdoutData(QString::fromUtf8(d->installer->readAllStandardOutput()));
|
||||||
}
|
}
|
||||||
|
|
||||||
void AbstractRemoteLinuxPackageInstaller::handleInstallerErrorOutput(const QByteArray &output)
|
void AbstractRemoteLinuxPackageInstaller::handleInstallerErrorOutput()
|
||||||
{
|
{
|
||||||
emit stderrData(QString::fromUtf8(output));
|
emit stderrData(QString::fromUtf8(d->installer->readAllStandardError()));
|
||||||
}
|
}
|
||||||
|
|
||||||
void AbstractRemoteLinuxPackageInstaller::setFinished()
|
void AbstractRemoteLinuxPackageInstaller::setFinished()
|
||||||
|
|||||||
@@ -67,8 +67,8 @@ protected:
|
|||||||
private slots:
|
private slots:
|
||||||
void handleConnectionError();
|
void handleConnectionError();
|
||||||
void handleInstallationFinished(int exitStatus);
|
void handleInstallationFinished(int exitStatus);
|
||||||
void handleInstallerOutput(const QByteArray &output);
|
void handleInstallerOutput();
|
||||||
void handleInstallerErrorOutput(const QByteArray &output);
|
void handleInstallerErrorOutput();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
virtual QString installCommandLine(const QString &packageFilePath) const = 0;
|
virtual QString installCommandLine(const QString &packageFilePath) const = 0;
|
||||||
|
|||||||
@@ -67,8 +67,6 @@ public:
|
|||||||
const LinuxDeviceConfiguration::ConstPtr deviceConfiguration;
|
const LinuxDeviceConfiguration::ConstPtr deviceConfiguration;
|
||||||
SshRemoteProcessRunner process;
|
SshRemoteProcessRunner process;
|
||||||
QList<RemoteProcess> remoteProcesses;
|
QList<RemoteProcess> remoteProcesses;
|
||||||
QByteArray remoteStdout;
|
|
||||||
QByteArray remoteStderr;
|
|
||||||
QString errorMsg;
|
QString errorMsg;
|
||||||
State state;
|
State state;
|
||||||
};
|
};
|
||||||
@@ -152,18 +150,6 @@ QVariant AbstractRemoteLinuxProcessList::data(const QModelIndex &index, int role
|
|||||||
return QVariant();
|
return QVariant();
|
||||||
}
|
}
|
||||||
|
|
||||||
void AbstractRemoteLinuxProcessList::handleRemoteStdOut(const QByteArray &output)
|
|
||||||
{
|
|
||||||
if (d->state == Listing)
|
|
||||||
d->remoteStdout += output;
|
|
||||||
}
|
|
||||||
|
|
||||||
void AbstractRemoteLinuxProcessList::handleRemoteStdErr(const QByteArray &output)
|
|
||||||
{
|
|
||||||
if (d->state != Inactive)
|
|
||||||
d->remoteStderr += output;
|
|
||||||
}
|
|
||||||
|
|
||||||
void AbstractRemoteLinuxProcessList::handleConnectionError()
|
void AbstractRemoteLinuxProcessList::handleConnectionError()
|
||||||
{
|
{
|
||||||
QTC_ASSERT(d->state != Inactive, return);
|
QTC_ASSERT(d->state != Inactive, return);
|
||||||
@@ -192,8 +178,9 @@ void AbstractRemoteLinuxProcessList::handleRemoteProcessFinished(int exitStatus)
|
|||||||
if (d->process.processExitCode() == 0) {
|
if (d->process.processExitCode() == 0) {
|
||||||
if (d->state == Listing) {
|
if (d->state == Listing) {
|
||||||
beginResetModel();
|
beginResetModel();
|
||||||
QList<RemoteProcess> processes = buildProcessList(QString::fromUtf8(d->remoteStdout.data(),
|
const QByteArray remoteStdout = d->process.readAllStandardOutput();
|
||||||
d->remoteStdout.count()));
|
QList<RemoteProcess> processes = buildProcessList(QString::fromUtf8(remoteStdout.data(),
|
||||||
|
remoteStdout.count()));
|
||||||
if (!processes.isEmpty()) {
|
if (!processes.isEmpty()) {
|
||||||
beginInsertRows(QModelIndex(), 0, processes.count()-1);
|
beginInsertRows(QModelIndex(), 0, processes.count()-1);
|
||||||
d->remoteProcesses = processes;
|
d->remoteProcesses = processes;
|
||||||
@@ -212,8 +199,9 @@ void AbstractRemoteLinuxProcessList::handleRemoteProcessFinished(int exitStatus)
|
|||||||
emit processListUpdated();
|
emit processListUpdated();
|
||||||
|
|
||||||
if (!d->errorMsg.isEmpty()) {
|
if (!d->errorMsg.isEmpty()) {
|
||||||
if (!d->remoteStderr.isEmpty())
|
const QByteArray remoteStderr = d->process.readAllStandardError();
|
||||||
d->errorMsg += tr("\nRemote stderr was: %1").arg(QString::fromUtf8(d->remoteStderr));
|
if (!remoteStderr.isEmpty())
|
||||||
|
d->errorMsg += tr("\nRemote stderr was: %1").arg(QString::fromUtf8(remoteStderr));
|
||||||
emit error(d->errorMsg);
|
emit error(d->errorMsg);
|
||||||
} else if (d->state == Killing) {
|
} else if (d->state == Killing) {
|
||||||
emit processKilled();
|
emit processKilled();
|
||||||
@@ -225,14 +213,8 @@ void AbstractRemoteLinuxProcessList::handleRemoteProcessFinished(int exitStatus)
|
|||||||
void AbstractRemoteLinuxProcessList::startProcess(const QString &cmdLine)
|
void AbstractRemoteLinuxProcessList::startProcess(const QString &cmdLine)
|
||||||
{
|
{
|
||||||
connect(&d->process, SIGNAL(connectionError()), SLOT(handleConnectionError()));
|
connect(&d->process, SIGNAL(connectionError()), SLOT(handleConnectionError()));
|
||||||
connect(&d->process, SIGNAL(processOutputAvailable(QByteArray)),
|
|
||||||
SLOT(handleRemoteStdOut(QByteArray)));
|
|
||||||
connect(&d->process, SIGNAL(processErrorOutputAvailable(QByteArray)),
|
|
||||||
SLOT(handleRemoteStdErr(QByteArray)));
|
|
||||||
connect(&d->process, SIGNAL(processClosed(int)),
|
connect(&d->process, SIGNAL(processClosed(int)),
|
||||||
SLOT(handleRemoteProcessFinished(int)));
|
SLOT(handleRemoteProcessFinished(int)));
|
||||||
d->remoteStdout.clear();
|
|
||||||
d->remoteStderr.clear();
|
|
||||||
d->errorMsg.clear();
|
d->errorMsg.clear();
|
||||||
d->process.run(cmdLine.toUtf8(), d->deviceConfiguration->sshParameters());
|
d->process.run(cmdLine.toUtf8(), d->deviceConfiguration->sshParameters());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -78,8 +78,6 @@ protected:
|
|||||||
QSharedPointer<const LinuxDeviceConfiguration> deviceConfiguration() const;
|
QSharedPointer<const LinuxDeviceConfiguration> deviceConfiguration() const;
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void handleRemoteStdOut(const QByteArray &output);
|
|
||||||
void handleRemoteStdErr(const QByteArray &output);
|
|
||||||
void handleConnectionError();
|
void handleConnectionError();
|
||||||
void handleRemoteProcessFinished(int exitStatus);
|
void handleRemoteProcessFinished(int exitStatus);
|
||||||
|
|
||||||
|
|||||||
@@ -349,13 +349,14 @@ void StartGdbServerDialog::handleProcessStarted()
|
|||||||
logMessage(tr("Starting gdbserver..."));
|
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()));
|
logMessage(QString::fromUtf8(ba.trimmed()));
|
||||||
// "Attached; pid = 16740"
|
// "Attached; pid = 16740"
|
||||||
// "Listening on port 10000"
|
// "Listening on port 10000"
|
||||||
@@ -397,10 +398,8 @@ void StartGdbServerDialog::startGdbServerOnPort(int port, int pid)
|
|||||||
LinuxDeviceConfiguration::ConstPtr device = d->currentDevice();
|
LinuxDeviceConfiguration::ConstPtr device = d->currentDevice();
|
||||||
connect(&d->runner, SIGNAL(connectionError()), SLOT(handleConnectionError()));
|
connect(&d->runner, SIGNAL(connectionError()), SLOT(handleConnectionError()));
|
||||||
connect(&d->runner, SIGNAL(processStarted()), SLOT(handleProcessStarted()));
|
connect(&d->runner, SIGNAL(processStarted()), SLOT(handleProcessStarted()));
|
||||||
connect(&d->runner, SIGNAL(processOutputAvailable(QByteArray)),
|
connect(&d->runner, SIGNAL(readyReadStandardOutput()), SLOT(handleProcessOutputAvailable()));
|
||||||
SLOT(handleProcessOutputAvailable(QByteArray)));
|
connect(&d->runner, SIGNAL(readyReadStandardError()), SLOT(handleProcessErrorOutput()));
|
||||||
connect(&d->runner, SIGNAL(processErrorOutputAvailable(QByteArray)),
|
|
||||||
SLOT(handleProcessErrorOutput(QByteArray)));
|
|
||||||
connect(&d->runner, SIGNAL(processClosed(int)), SLOT(handleProcessClosed(int)));
|
connect(&d->runner, SIGNAL(processClosed(int)), SLOT(handleProcessClosed(int)));
|
||||||
|
|
||||||
QByteArray cmd = "/usr/bin/gdbserver --attach :"
|
QByteArray cmd = "/usr/bin/gdbserver --attach :"
|
||||||
|
|||||||
@@ -67,8 +67,8 @@ private slots:
|
|||||||
void portListReady();
|
void portListReady();
|
||||||
|
|
||||||
void handleProcessClosed(int);
|
void handleProcessClosed(int);
|
||||||
void handleProcessErrorOutput(const QByteArray &data);
|
void handleProcessErrorOutput();
|
||||||
void handleProcessOutputAvailable(const QByteArray &data);
|
void handleProcessOutputAvailable();
|
||||||
void handleProcessStarted();
|
void handleProcessStarted();
|
||||||
void handleConnectionError();
|
void handleConnectionError();
|
||||||
|
|
||||||
|
|||||||
@@ -66,10 +66,8 @@ void RemoteProcessTest::run()
|
|||||||
SLOT(handleConnectionError()));
|
SLOT(handleConnectionError()));
|
||||||
connect(m_remoteRunner, SIGNAL(processStarted()),
|
connect(m_remoteRunner, SIGNAL(processStarted()),
|
||||||
SLOT(handleProcessStarted()));
|
SLOT(handleProcessStarted()));
|
||||||
connect(m_remoteRunner, SIGNAL(processOutputAvailable(QByteArray)),
|
connect(m_remoteRunner, SIGNAL(readyReadStandardOutput()), SLOT(handleProcessStdout()));
|
||||||
SLOT(handleProcessStdout(QByteArray)));
|
connect(m_remoteRunner, SIGNAL(readyReadStandardError()), SLOT(handleProcessStderr()));
|
||||||
connect(m_remoteRunner, SIGNAL(processErrorOutputAvailable(QByteArray)),
|
|
||||||
SLOT(handleProcessStderr(QByteArray)));
|
|
||||||
connect(m_remoteRunner, SIGNAL(processClosed(int)),
|
connect(m_remoteRunner, SIGNAL(processClosed(int)),
|
||||||
SLOT(handleProcessClosed(int)));
|
SLOT(handleProcessClosed(int)));
|
||||||
|
|
||||||
@@ -109,7 +107,7 @@ void RemoteProcessTest::handleProcessStarted()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void RemoteProcessTest::handleProcessStdout(const QByteArray &output)
|
void RemoteProcessTest::handleProcessStdout()
|
||||||
{
|
{
|
||||||
if (!m_started) {
|
if (!m_started) {
|
||||||
std::cerr << "Error: Remote output from non-started process."
|
std::cerr << "Error: Remote output from non-started process."
|
||||||
@@ -120,11 +118,11 @@ void RemoteProcessTest::handleProcessStdout(const QByteArray &output)
|
|||||||
<< "." << std::endl;
|
<< "." << std::endl;
|
||||||
qApp->quit();
|
qApp->quit();
|
||||||
} else {
|
} else {
|
||||||
m_remoteStdout += output;
|
m_remoteStdout += m_remoteRunner->readAllStandardOutput();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void RemoteProcessTest::handleProcessStderr(const QByteArray &output)
|
void RemoteProcessTest::handleProcessStderr()
|
||||||
{
|
{
|
||||||
if (!m_started) {
|
if (!m_started) {
|
||||||
std::cerr << "Error: Remote error output from non-started process."
|
std::cerr << "Error: Remote error output from non-started process."
|
||||||
@@ -135,7 +133,7 @@ void RemoteProcessTest::handleProcessStderr(const QByteArray &output)
|
|||||||
<< std::endl;
|
<< std::endl;
|
||||||
qApp->quit();
|
qApp->quit();
|
||||||
} else {
|
} else {
|
||||||
m_remoteStderr += output;
|
m_remoteStderr += m_remoteRunner->readAllStandardError();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -51,8 +51,8 @@ public:
|
|||||||
private slots:
|
private slots:
|
||||||
void handleConnectionError();
|
void handleConnectionError();
|
||||||
void handleProcessStarted();
|
void handleProcessStarted();
|
||||||
void handleProcessStdout(const QByteArray &output);
|
void handleProcessStdout();
|
||||||
void handleProcessStderr(const QByteArray &output);
|
void handleProcessStderr();
|
||||||
void handleProcessClosed(int exitStatus);
|
void handleProcessClosed(int exitStatus);
|
||||||
void handleTimeout();
|
void handleTimeout();
|
||||||
void handleReadyRead();
|
void handleReadyRead();
|
||||||
|
|||||||
Reference in New Issue
Block a user