Utils: Fix terminal process environment

The TerminalInterface did not fallback to the system environment
if no environment was set by the user. Instead it had platform
specific code that saved over the path.

Instead we just apply the user changes to the system environment.

Change-Id: I011f1a9d935c958265b2bda8257ad8611f06e578
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
Marcus Tillmanns
2024-06-04 09:09:07 +02:00
parent 1543ead1b6
commit a30eb2ccc4

View File

@@ -334,22 +334,12 @@ void TerminalInterface::start()
Environment finalEnv = m_setup.m_environment;
if (HostOsInfo::isWindowsHost()) {
if (!finalEnv.hasKey("PATH")) {
const QString path = qtcEnvironmentVariable("PATH");
if (!path.isEmpty())
finalEnv.set("PATH", path);
}
if (!finalEnv.hasKey("SystemRoot")) {
const QString systemRoot = qtcEnvironmentVariable("SystemRoot");
if (!systemRoot.isEmpty())
finalEnv.set("SystemRoot", systemRoot);
}
} else if (HostOsInfo::isMacHost()) {
if (HostOsInfo::isMacHost())
finalEnv.set("TERM", "xterm-256color");
}
if (finalEnv.hasChanges()) {
finalEnv = finalEnv.appliedToEnvironment(Environment::systemEnvironment());
d->envListFile = std::make_unique<QTemporaryFile>(this);
if (!d->envListFile->open()) {
cleanupAfterStartFailure(msgCannotCreateTempFile(d->envListFile->errorString()));