forked from qt-creator/qt-creator
Move SSH support into a dedicated library.
It does not belong into libUtils, which is a collection of small unrelated utility classes. Task-number: QTCREATORBUG-7218 Change-Id: Id92b9f28678afec93e6f07166adfde6550f38072 Reviewed-by: Eike Ziller <eike.ziller@nokia.com>
This commit is contained in:
@@ -148,7 +148,7 @@ void LocalValgrindProcess::readyReadStandardOutput()
|
||||
|
||||
////////////////////////
|
||||
|
||||
RemoteValgrindProcess::RemoteValgrindProcess(const Utils::SshConnectionParameters &sshParams,
|
||||
RemoteValgrindProcess::RemoteValgrindProcess(const QSsh::SshConnectionParameters &sshParams,
|
||||
QObject *parent)
|
||||
: ValgrindProcess(parent)
|
||||
, m_params(sshParams)
|
||||
@@ -156,7 +156,7 @@ RemoteValgrindProcess::RemoteValgrindProcess(const Utils::SshConnectionParameter
|
||||
, m_pid(0)
|
||||
{}
|
||||
|
||||
RemoteValgrindProcess::RemoteValgrindProcess(const Utils::SshConnection::Ptr &connection, QObject *parent)
|
||||
RemoteValgrindProcess::RemoteValgrindProcess(const QSsh::SshConnection::Ptr &connection, QObject *parent)
|
||||
: ValgrindProcess(parent)
|
||||
, m_params(connection->connectionParameters())
|
||||
, m_connection(connection)
|
||||
@@ -179,14 +179,14 @@ void RemoteValgrindProcess::run(const QString &valgrindExecutable, const QString
|
||||
|
||||
// connect to host and wait for connection
|
||||
if (!m_connection)
|
||||
m_connection = Utils::SshConnection::create(m_params);
|
||||
m_connection = QSsh::SshConnection::create(m_params);
|
||||
|
||||
if (m_connection->state() != Utils::SshConnection::Connected) {
|
||||
if (m_connection->state() != QSsh::SshConnection::Connected) {
|
||||
connect(m_connection.data(), SIGNAL(connected()),
|
||||
this, SLOT(connected()));
|
||||
connect(m_connection.data(), SIGNAL(error(Utils::SshError)),
|
||||
this, SLOT(error(Utils::SshError)));
|
||||
if (m_connection->state() == Utils::SshConnection::Unconnected)
|
||||
connect(m_connection.data(), SIGNAL(error(QSsh::SshError)),
|
||||
this, SLOT(error(QSsh::SshError)));
|
||||
if (m_connection->state() == QSsh::SshConnection::Unconnected)
|
||||
m_connection->connectToHost();
|
||||
} else {
|
||||
connected();
|
||||
@@ -195,7 +195,7 @@ void RemoteValgrindProcess::run(const QString &valgrindExecutable, const QString
|
||||
|
||||
void RemoteValgrindProcess::connected()
|
||||
{
|
||||
QTC_ASSERT(m_connection->state() == Utils::SshConnection::Connected, return);
|
||||
QTC_ASSERT(m_connection->state() == QSsh::SshConnection::Connected, return);
|
||||
|
||||
// connected, run command
|
||||
QString cmd;
|
||||
@@ -219,14 +219,14 @@ void RemoteValgrindProcess::connected()
|
||||
m_process->start();
|
||||
}
|
||||
|
||||
Utils::SshConnection::Ptr RemoteValgrindProcess::connection() const
|
||||
QSsh::SshConnection::Ptr RemoteValgrindProcess::connection() const
|
||||
{
|
||||
return m_connection;
|
||||
}
|
||||
|
||||
void RemoteValgrindProcess::processStarted()
|
||||
{
|
||||
QTC_ASSERT(m_connection->state() == Utils::SshConnection::Connected, return);
|
||||
QTC_ASSERT(m_connection->state() == QSsh::SshConnection::Connected, return);
|
||||
|
||||
// find out what PID our process has
|
||||
|
||||
@@ -278,10 +278,10 @@ void RemoteValgrindProcess::standardError()
|
||||
emit processOutput(m_process->readAllStandardError(), Utils::StdErrFormat);
|
||||
}
|
||||
|
||||
void RemoteValgrindProcess::error(Utils::SshError error)
|
||||
void RemoteValgrindProcess::error(QSsh::SshError error)
|
||||
{
|
||||
switch (error) {
|
||||
case Utils::SshTimeoutError:
|
||||
case QSsh::SshTimeoutError:
|
||||
m_error = QProcess::Timedout;
|
||||
break;
|
||||
default:
|
||||
@@ -294,7 +294,7 @@ void RemoteValgrindProcess::error(Utils::SshError error)
|
||||
|
||||
void RemoteValgrindProcess::close()
|
||||
{
|
||||
QTC_ASSERT(m_connection->state() == Utils::SshConnection::Connected, return);
|
||||
QTC_ASSERT(m_connection->state() == QSsh::SshConnection::Connected, return);
|
||||
if (m_process) {
|
||||
if (m_pid) {
|
||||
const QString killTemplate = QString("kill -%2 %1" // kill
|
||||
@@ -304,7 +304,7 @@ void RemoteValgrindProcess::close()
|
||||
const QString brutalKill = killTemplate.arg("SIGKILL");
|
||||
const QString remoteCall = niceKill + QLatin1String("; sleep 1; ") + brutalKill;
|
||||
|
||||
Utils::SshRemoteProcess::Ptr cleanup = m_connection->createRemoteProcess(remoteCall.toUtf8());
|
||||
QSsh::SshRemoteProcess::Ptr cleanup = m_connection->createRemoteProcess(remoteCall.toUtf8());
|
||||
cleanup->start();
|
||||
}
|
||||
}
|
||||
@@ -315,12 +315,12 @@ void RemoteValgrindProcess::closed(int status)
|
||||
QTC_ASSERT(m_process, return);
|
||||
|
||||
m_errorString = m_process->errorString();
|
||||
if (status == Utils::SshRemoteProcess::FailedToStart) {
|
||||
if (status == QSsh::SshRemoteProcess::FailedToStart) {
|
||||
m_error = QProcess::FailedToStart;
|
||||
emit ValgrindProcess::error(QProcess::FailedToStart);
|
||||
} else if (status == Utils::SshRemoteProcess::ExitedNormally) {
|
||||
} else if (status == QSsh::SshRemoteProcess::ExitedNormally) {
|
||||
emit finished(m_process->exitCode(), QProcess::NormalExit);
|
||||
} else if (status == Utils::SshRemoteProcess::KilledBySignal) {
|
||||
} else if (status == QSsh::SshRemoteProcess::KilledBySignal) {
|
||||
m_error = QProcess::Crashed;
|
||||
emit finished(m_process->exitCode(), QProcess::CrashExit);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user