SshRemoteProcess: Get rid of error arg from done() signal

Prepare for signal rename done() -> finished().

Change-Id: I81a7bd0a4826ce6200f4af47ba5868ceedb42206
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Jarek Kobus
2022-02-28 14:11:49 +01:00
parent fc3b9b5ab3
commit 7b5dfcd6cd
11 changed files with 22 additions and 22 deletions

View File

@@ -58,14 +58,13 @@ SshRemoteProcess::SshRemoteProcess(const QString &command, const QStringList &co
m_connectionArgs = connectionArgs;
connect(this, &QtcProcess::finished, this, [this] {
QString error;
if (exitStatus() == QProcess::CrashExit)
error = tr("The ssh process crashed: %1").arg(errorString());
emit done(error);
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(errorString());
emit done();
});
}

View File

@@ -48,7 +48,7 @@ public:
static bool setupSshEnvironment(Utils::QtcProcess *process);
signals:
void done(const QString &error);
void done();
private:
QString m_remoteCommand;

View File

@@ -142,11 +142,11 @@ void SshRemoteProcessRunner::handleProcessStarted()
emit processStarted();
}
void SshRemoteProcessRunner::handleProcessFinished(const QString &error)
void SshRemoteProcessRunner::handleProcessFinished()
{
d->m_exitStatus = d->m_process->exitStatus();
d->m_exitCode = d->m_process->exitCode();
d->m_processErrorString = error;
d->m_processErrorString = d->m_process->errorString();
setState(Inactive);
emit processClosed(d->m_processErrorString);
}

View File

@@ -64,7 +64,7 @@ private:
void handleConnectionError();
void handleDisconnected();
void handleProcessStarted();
void handleProcessFinished(const QString &error);
void handleProcessFinished();
void runInternal(const QString &command, const QSsh::SshConnectionParameters &sshParams);
void setState(int newState);

View File

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

View File

@@ -200,12 +200,11 @@ 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](const QString &errorMsg) {
connect(statProc, &SshRemoteProcess::done, this, [this, statProc, state = d->state] {
QTC_ASSERT(d->state == state, return);
const DeployableFile file = d->getFileForProcess(statProc);
QTC_ASSERT(file.isValid(), return);
const QDateTime timestamp = timestampFromStat(file, statProc, errorMsg);
const QDateTime timestamp = timestampFromStat(file, statProc, statProc->errorString());
statProc->deleteLater();
switch (state) {
case PreChecking:
@@ -342,11 +341,11 @@ void GenericDirectUploadService::chmod()
SshRemoteProcess * const chmodProc
= connection()->createRemoteProcess(command).release();
chmodProc->setParent(this);
connect(chmodProc, &SshRemoteProcess::done, this,
[this, chmodProc, state = d->state](const QString &error) {
connect(chmodProc, &SshRemoteProcess::done, this, [this, chmodProc, state = d->state] {
QTC_ASSERT(state == d->state, return);
const DeployableFile file = d->getFileForProcess(chmodProc);
QTC_ASSERT(file.isValid(), return);
const QString error = chmodProc->errorString();
if (!error.isEmpty()) {
emit warningMessage(tr("Remote chmod failed for file \"%1\": %2")
.arg(file.remoteFilePath(), error));

View File

@@ -143,11 +143,11 @@ void GenericLinuxDeviceTester::handleConnectionFailure()
setFinished(TestFailure);
}
void GenericLinuxDeviceTester::handleProcessFinished(const QString &error)
void GenericLinuxDeviceTester::handleProcessFinished()
{
QTC_ASSERT(d->state == RunningUname, return);
if (!error.isEmpty() || d->process->exitCode() != 0) {
if (!d->process->errorString().isEmpty() || d->process->exitCode() != 0) {
const QByteArray stderrOutput = d->process->readAllStandardError();
if (!stderrOutput.isEmpty())
emit errorMessage(tr("uname failed: %1").arg(QString::fromUtf8(stderrOutput)) + QLatin1Char('\n'));

View File

@@ -47,7 +47,7 @@ public:
private:
void handleConnected();
void handleConnectionFailure();
void handleProcessFinished(const QString &error);
void handleProcessFinished();
void handlePortsGatheringError(const QString &message);
void handlePortListReady();
void handleSftpStarted();

View File

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

View File

@@ -95,10 +95,10 @@ void Shell::handleRemoteStderr()
std::cerr << m_shell->readAllStandardError().data() << std::flush;
}
void Shell::handleChannelClosed(const QString &error)
void Shell::handleChannelClosed()
{
std::cerr << "Shell closed. Exit code was " << m_shell->exitCode() << "." << std::endl;
QCoreApplication::exit(error.isEmpty() && m_shell->exitCode() == 0
QCoreApplication::exit(m_shell->errorString().isEmpty() && m_shell->exitCode() == 0
? EXIT_SUCCESS : EXIT_FAILURE);
}

View File

@@ -50,7 +50,7 @@ private:
void handleRemoteStdout();
void handleRemoteStderr();
void handleShellMessage(const QString &message);
void handleChannelClosed(const QString &error);
void handleChannelClosed();
void handleShellStarted();
void handleStdin();