Docker: Fix shell exit handling

Previously if a docker container was removed outside of Qt Creator
the shell would not be correctly reset by the dockerdevice and
therefor cause a hang.

Change-Id: I5e84f7c114e525c732f45b701277736d6acc7a11
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
This commit is contained in:
Marcus Tillmanns
2023-03-10 14:49:55 +01:00
parent 2509c3471b
commit 666f3258ba
2 changed files with 2 additions and 1 deletions

View File

@@ -98,6 +98,7 @@ RunResult DeviceShell::run(const CommandLine &cmd, const QByteArray &stdInData)
const RunResult errorResult{-1, {}, {}};
QTC_ASSERT(m_shellProcess, return errorResult);
QTC_ASSERT(m_shellProcess->isRunning(), return errorResult);
QTC_ASSERT(m_shellScriptState == State::Succeeded, return errorResult);
QMutexLocker lk(&m_commandMutex);

View File

@@ -679,12 +679,12 @@ void DockerDevicePrivate::startContainer()
m_shell = std::make_unique<ContainerShell>(m_settings, m_container, q->rootPath());
connect(m_shell.get(), &DeviceShell::done, this, [this](const ProcessResultData &resultData) {
m_shell.release()->deleteLater();
if (resultData.m_error != QProcess::UnknownError
|| resultData.m_exitStatus == QProcess::NormalExit)
return;
qCWarning(dockerDeviceLog) << "Container shell encountered error:" << resultData.m_error;
m_shell.release()->deleteLater();
DockerApi::recheckDockerDaemon();
MessageManager::writeFlashing(Tr::tr("Docker daemon appears to be not running. "