docker: Fix run environment setup

When starting a debug session the systemEnvironment() was used
as the basis for the debugger process. If the docker device
did not have the same shell installed as the host, this would
break gdb as the SHELL= env variable might point to a
non-existing shell binary.

Change-Id: I7253ad3c4995eed857279146f1b258febe1ca710
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Marcus Tillmanns
2022-07-12 11:34:34 +02:00
parent 226abd4de7
commit 78e7c7b2a6
3 changed files with 14 additions and 6 deletions

View File

@@ -47,6 +47,8 @@
#include <coreplugin/icore.h>
#include <coreplugin/idocument.h>
#include <projectexplorer/devicesupport/idevice.h>
#include <utils/algorithm.h>
#include <utils/detailswidget.h>
#include <utils/layoutbuilder.h>
@@ -486,8 +488,10 @@ void BuildConfiguration::setBuildDirectorySettingsKey(const QString &key)
Environment BuildConfiguration::baseEnvironment() const
{
Environment result;
if (useSystemEnvironment())
result = Environment::systemEnvironment();
if (useSystemEnvironment()) {
ProjectExplorer::IDevice::ConstPtr devicePtr = BuildDeviceKitAspect::device(kit());
result = devicePtr ? devicePtr->systemEnvironment() : Environment::systemEnvironment();
}
addToEnvironment(result);
kit()->addToBuildEnvironment(result);
result.modify(project()->additionalEnvironment());