Terminal: Improve error message for start errors

Also fixes an issue where "Open Shell In Container" would fail if
the container has not been started yet.

Previously only "An Error occurred" was displayed to the user if
starting the terminal failed.

With this fix it gives more info about what went wrong, and a
specific error message is created if the openTerminal.py script
is not executable.

Change-Id: I49ae0d9b2aa7d5a27a9b100830b4fdefa5a279b8
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
This commit is contained in:
Marcus Tillmanns
2022-09-06 09:19:37 +02:00
parent aeb5f90d71
commit 0cb3459c71
2 changed files with 8 additions and 9 deletions

View File

@@ -393,12 +393,12 @@ void TerminalImpl::start()
d->m_process.setCommand({FilePath::fromString(terminal.command), allArgs});
d->m_process.setProcessImpl(m_setup.m_processImpl);
d->m_process.setReaperTimeout(m_setup.m_reaperTimeout);
d->m_process.start();
if (!d->m_process.waitForStarted()) {
const QString msg
= QtcProcess::tr("Cannot start the terminal emulator \"%1\", change the setting in the "
"Environment options.")
.arg(terminal.command);
const QString msg = QtcProcess::tr("Cannot start the terminal emulator \"%1\", change the "
"setting in the Environment options. (%2)")
.arg(terminal.command).arg(d->m_process.errorString());
cleanupAfterStartFailure(msg);
return;
}

View File

@@ -333,8 +333,10 @@ DockerDevice::DockerDevice(DockerSettings *settings, const DockerDeviceData &dat
proc->setTerminalMode(TerminalMode::On);
QObject::connect(proc, &QtcProcess::done, [proc] {
if (proc->error() != QProcess::UnknownError && MessageManager::instance())
MessageManager::writeDisrupting(Tr::tr("Error starting remote shell."));
if (proc->error() != QProcess::UnknownError && MessageManager::instance()) {
MessageManager::writeDisrupting(
Tr::tr("Error starting remote shell: %1").arg(proc->errorString()));
}
proc->deleteLater();
});
@@ -492,9 +494,6 @@ void DockerDevicePrivate::startContainer()
void DockerDevicePrivate::updateContainerAccess()
{
if (!m_container.isEmpty())
return;
if (DockerApi::isDockerDaemonAvailable(false).value_or(false) == false)
return;