LinuxDevice: Connect to QtcProcess::done() signal

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

Change-Id: I939927b68e84b32455a914cef26200b4edcbcbb6
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Jarek Kobus
2022-04-14 13:02:16 +02:00
parent 42fc527fec
commit ec4fb84f8d

View File

@@ -333,17 +333,20 @@ LinuxDevice::LinuxDevice()
setOpenTerminal([this](const Environment &env, const FilePath &workingDir) { setOpenTerminal([this](const Environment &env, const FilePath &workingDir) {
QtcProcess * const proc = createProcess(nullptr); QtcProcess * const proc = createProcess(nullptr);
QObject::connect(proc, &QtcProcess::finished, [proc] { QObject::connect(proc, &QtcProcess::done, [proc] {
if (!proc->errorString().isEmpty()) { if (proc->error() != QProcess::UnknownError) {
Core::MessageManager::writeDisrupting( const QString errorString = proc->errorString();
tr("Error running remote shell: %1").arg(proc->errorString())); QString message;
if (proc->error() == QProcess::FailedToStart)
message = tr("Error starting remote shell.");
else if (errorString.isEmpty())
message = tr("Error running remote shell.");
else
message = tr("Error running remote shell: %1").arg(errorString);
Core::MessageManager::writeDisrupting(message);
} }
proc->deleteLater(); proc->deleteLater();
}); });
QObject::connect(proc, &QtcProcess::errorOccurred, [proc] {
Core::MessageManager::writeDisrupting(tr("Error starting remote shell."));
proc->deleteLater();
});
// It seems we cannot pass an environment to OpenSSH dynamically // It seems we cannot pass an environment to OpenSSH dynamically
// without specifying an executable. // without specifying an executable.