Docker: Warn if file access through merged dir is impossible

Even when the fallbacks via 'docker exec' work this will cause a
significant performance hit. Better inform the user.

Change-Id: If369dcc498bffa2ef422dab3e69325c4122b45ad
Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
hjk
2021-06-10 07:23:35 +02:00
parent ef730d5ffb
commit 71db2d9c4f

View File

@@ -510,11 +510,19 @@ void DockerDevicePrivate::tryCreateLocalFileAccess()
//LOG(proc2.commandLine().toUserOutput());
proc.start();
proc.waitForFinished();
const QByteArray out = proc.readAllStandardOutput();
m_mergedDir = QString::fromUtf8(out).trimmed();
const QString out = proc.stdOut();
m_mergedDir = out.trimmed();
if (m_mergedDir.endsWith('/'))
m_mergedDir.chop(1);
if (!QFileInfo(m_mergedDir).isWritable()) {
MessageManager::writeFlashing(
tr("Local write access to Docker container %1 unavailable through directory \"%2\".")
.arg(m_container, m_mergedDir)
+ '\n' + tr("Output: %1").arg(out)
+ '\n' + tr("Error: %1").arg(proc.stdErr()));
}
m_mergedDirWatcher.addPath(m_mergedDir);
}