QtcSsh: Connect to QtcProcess::done() signal

Instead of connecting to errorOccurred() and finished() signals.

Change-Id: I113f51564501a67725afee77ab4d20e5d954a7c0
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Jarek Kobus
2022-04-05 16:09:26 +02:00
parent 5b923954c0
commit 484ea3ecc9
3 changed files with 18 additions and 32 deletions

View File

@@ -186,21 +186,12 @@ SshConnection::SshConnection(const SshConnectionParameters &serverInfo, QObject
if (reply == "\n")
emitConnected();
});
connect(&d->masterProcess, &QtcProcess::errorOccurred, [this] (QProcess::ProcessError error) {
switch (error) {
case QProcess::FailedToStart:
connect(&d->masterProcess, &QtcProcess::done, this, [this] {
if (d->masterProcess.error() == QProcess::FailedToStart) {
emitError(tr("Cannot establish SSH connection: Control process failed to start: %1")
.arg(d->fullProcessError()));
break;
case QProcess::Crashed: // Handled by finished() handler.
case QProcess::Timedout:
case QProcess::ReadError:
case QProcess::WriteError:
case QProcess::UnknownError:
break; // Cannot happen.
return;
}
});
connect(&d->masterProcess, &QtcProcess::finished, [this] {
if (d->state == Disconnecting) {
emitDisconnected();
return;