From a30eb2ccc49a50828f24fd69b308c122092fbfff Mon Sep 17 00:00:00 2001 From: Marcus Tillmanns Date: Tue, 4 Jun 2024 09:09:07 +0200 Subject: [PATCH] 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 --- src/libs/utils/terminalinterface.cpp | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/src/libs/utils/terminalinterface.cpp b/src/libs/utils/terminalinterface.cpp index 0d5a3be0203..45bdd8a4f9d 100644 --- a/src/libs/utils/terminalinterface.cpp +++ b/src/libs/utils/terminalinterface.cpp @@ -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(this); if (!d->envListFile->open()) { cleanupAfterStartFailure(msgCannotCreateTempFile(d->envListFile->errorString()));