forked from qt-creator/qt-creator
Docker: Guard against empty mounts
Using empty mounts makes using the container fail. Change-Id: I65041eae3a1ebeec936861b4f85977981bbd84d3 Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -354,7 +354,7 @@ public:
|
||||
m_pathsLineEdit->setText(data.mounts.join(';'));
|
||||
|
||||
connect(m_pathsLineEdit, &QLineEdit::textChanged, this, [dockerDevice](const QString &text) {
|
||||
dockerDevice->setMounts(text.split(';'));
|
||||
dockerDevice->setMounts(text.split(';', Qt::SkipEmptyParts));
|
||||
});
|
||||
|
||||
auto logView = new QTextBrowser;
|
||||
@@ -654,8 +654,10 @@ void DockerDevicePrivate::tryCreateLocalFileAccess()
|
||||
dockerRun.addArgs({"-u", QString("%1:%2").arg(getuid()).arg(getgid())});
|
||||
#endif
|
||||
|
||||
for (const QString &mount : qAsConst(m_data.mounts))
|
||||
dockerRun.addArgs({"-v", mount + ':' + mount});
|
||||
for (const QString &mount : qAsConst(m_data.mounts)) {
|
||||
if (!mount.isEmpty())
|
||||
dockerRun.addArgs({"-v", mount + ':' + mount});
|
||||
}
|
||||
|
||||
dockerRun.addArg(m_data.imageId);
|
||||
dockerRun.addArg("/bin/sh");
|
||||
|
Reference in New Issue
Block a user