forked from qt-creator/qt-creator
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:
@@ -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);
|
||||
|
@@ -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. "
|
||||
|
Reference in New Issue
Block a user