SshRemoteProcess: Rename done() -> finished()

Change-Id: I9c22d075f50b0a2a171cbda11c7579e4735f3f4e
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
This commit is contained in:
Jarek Kobus
2022-02-28 15:19:42 +01:00
parent 590ae0e954
commit 0dfcc97a3e
9 changed files with 25 additions and 20 deletions

View File

@@ -56,16 +56,20 @@ SshRemoteProcess::SshRemoteProcess(const QString &command, const QStringList &co
setupSshEnvironment(this);
m_remoteCommand = command;
m_connectionArgs = connectionArgs;
}
connect(this, &QtcProcess::finished, this, [this] {
if (exitStatus() == QProcess::CrashExit)
setErrorString(tr("The ssh process crashed: %1").arg(errorString()));
emit done();
});
connect(this, &QtcProcess::errorOccurred, [this](QProcess::ProcessError error) {
if (error == QProcess::FailedToStart)
emit done();
});
void SshRemoteProcess::emitFinished()
{
if (exitStatus() == QProcess::CrashExit)
setErrorString(tr("The ssh process crashed: %1").arg(errorString()));
emit finished();
}
void SshRemoteProcess::emitErrorOccurred(QProcess::ProcessError error)
{
if (error == QProcess::FailedToStart)
emit finished();
emit errorOccurred(error);
}
void SshRemoteProcess::start()

View File

@@ -47,8 +47,9 @@ public:
static bool setupSshEnvironment(Utils::QtcProcess *process);
signals:
void done();
protected:
void emitFinished() override;
void emitErrorOccurred(QProcess::ProcessError error) override;
private:
QString m_remoteCommand;

View File

@@ -111,7 +111,7 @@ void SshRemoteProcessRunner::handleConnected()
d->m_process = d->m_connection->createRemoteProcess(d->m_command);
connect(d->m_process.get(), &SshRemoteProcess::started,
this, &SshRemoteProcessRunner::handleProcessStarted);
connect(d->m_process.get(), &SshRemoteProcess::done,
connect(d->m_process.get(), &SshRemoteProcess::finished,
this, &SshRemoteProcessRunner::handleProcessFinished);
connect(d->m_process.get(), &SshRemoteProcess::readyReadStandardOutput,
this, &SshRemoteProcessRunner::readyReadStandardOutput);

View File

@@ -193,7 +193,7 @@ void SshDeviceProcess::handleConnected()
} else {
connect(d->remoteProcess.get(), &QSsh::SshRemoteProcess::started,
this, &SshDeviceProcess::handleProcessStarted);
connect(d->remoteProcess.get(), &QSsh::SshRemoteProcess::done, this, [this] {
connect(d->remoteProcess.get(), &QSsh::SshRemoteProcess::finished, this, [this] {
handleProcessFinished(d->remoteProcess->errorString());
});
connect(d->remoteProcess.get(), &QSsh::SshRemoteProcess::readyReadStandardOutput,

View File

@@ -200,7 +200,7 @@ void GenericDirectUploadService::runStat(const DeployableFile &file)
const QString statCmd = "stat -t " + Utils::ProcessArgs::quoteArgUnix(file.remoteFilePath());
SshRemoteProcess * const statProc = connection()->createRemoteProcess(statCmd).release();
statProc->setParent(this);
connect(statProc, &SshRemoteProcess::done, this, [this, statProc, state = d->state] {
connect(statProc, &SshRemoteProcess::finished, this, [this, statProc, state = d->state] {
QTC_ASSERT(d->state == state, return);
const DeployableFile file = d->getFileForProcess(statProc);
QTC_ASSERT(file.isValid(), return);
@@ -341,7 +341,7 @@ void GenericDirectUploadService::chmod()
SshRemoteProcess * const chmodProc
= connection()->createRemoteProcess(command).release();
chmodProc->setParent(this);
connect(chmodProc, &SshRemoteProcess::done, this, [this, chmodProc, state = d->state] {
connect(chmodProc, &SshRemoteProcess::finished, this, [this, chmodProc, state = d->state] {
QTC_ASSERT(state == d->state, return);
const DeployableFile file = d->getFileForProcess(chmodProc);
QTC_ASSERT(file.isValid(), return);

View File

@@ -126,7 +126,7 @@ void GenericLinuxDeviceTester::handleConnected()
QTC_ASSERT(d->state == Connecting, return);
d->process = d->connection->createRemoteProcess("uname -rsm");
connect(d->process.get(), &SshRemoteProcess::done,
connect(d->process.get(), &SshRemoteProcess::finished,
this, &GenericLinuxDeviceTester::handleProcessFinished);
emit progressMessage(tr("Checking kernel version..."));

View File

@@ -103,7 +103,7 @@ void RsyncDeployService::createRemoteDirectories()
remoteDirs.removeDuplicates();
m_mkdir = connection()->createRemoteProcess("mkdir -p " +
ProcessArgs::createUnixArgs(remoteDirs).toString());
connect(m_mkdir.get(), &SshRemoteProcess::done, this, [this] {
connect(m_mkdir.get(), &SshRemoteProcess::finished, this, [this] {
QString userError;
const QString error = m_mkdir->errorString();
if (!error.isEmpty())

View File

@@ -299,7 +299,7 @@ void tst_Ssh::remoteProcessChannels()
SshRemoteProcessPtr echoProcess
= connection.createRemoteProcess("printf " + QString::fromUtf8(testString) + " >&2");
QEventLoop loop;
connect(echoProcess.get(), &SshRemoteProcess::done, &loop, &QEventLoop::quit);
connect(echoProcess.get(), &SshRemoteProcess::finished, &loop, &QEventLoop::quit);
connect(echoProcess.get(), &Utils::QtcProcess::readyReadStandardError,
[&remoteData, p = echoProcess.get()] { remoteData += p->readAllStandardError(); });
connect(echoProcess.get(), &SshRemoteProcess::readyReadStandardOutput,
@@ -334,7 +334,7 @@ void tst_Ssh::remoteProcessInput()
catProcess->setProcessMode(Utils::ProcessMode::Writer);
QEventLoop loop;
connect(catProcess.get(), &SshRemoteProcess::started, &loop, &QEventLoop::quit);
connect(catProcess.get(), &SshRemoteProcess::done, &loop, &QEventLoop::quit);
connect(catProcess.get(), &SshRemoteProcess::finished, &loop, &QEventLoop::quit);
QTimer timer;
QObject::connect(&timer, &QTimer::timeout, &loop, &QEventLoop::quit);
timer.setSingleShot(true);

View File

@@ -75,7 +75,7 @@ void Shell::handleConnected()
this, &Shell::handleRemoteStdout);
connect(m_shell.get(), &SshRemoteProcess::readyReadStandardError,
this, &Shell::handleRemoteStderr);
connect(m_shell.get(), &SshRemoteProcess::done, this, &Shell::handleChannelClosed);
connect(m_shell.get(), &SshRemoteProcess::finished, this, &Shell::handleChannelClosed);
m_shell->start();
}