forked from qt-creator/qt-creator
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:
@@ -334,22 +334,12 @@ void TerminalInterface::start()
|
|||||||
|
|
||||||
Environment finalEnv = m_setup.m_environment;
|
Environment finalEnv = m_setup.m_environment;
|
||||||
|
|
||||||
if (HostOsInfo::isWindowsHost()) {
|
if (HostOsInfo::isMacHost())
|
||||||
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()) {
|
|
||||||
finalEnv.set("TERM", "xterm-256color");
|
finalEnv.set("TERM", "xterm-256color");
|
||||||
}
|
|
||||||
|
|
||||||
if (finalEnv.hasChanges()) {
|
if (finalEnv.hasChanges()) {
|
||||||
|
finalEnv = finalEnv.appliedToEnvironment(Environment::systemEnvironment());
|
||||||
|
|
||||||
d->envListFile = std::make_unique<QTemporaryFile>(this);
|
d->envListFile = std::make_unique<QTemporaryFile>(this);
|
||||||
if (!d->envListFile->open()) {
|
if (!d->envListFile->open()) {
|
||||||
cleanupAfterStartFailure(msgCannotCreateTempFile(d->envListFile->errorString()));
|
cleanupAfterStartFailure(msgCannotCreateTempFile(d->envListFile->errorString()));
|
||||||
|
Reference in New Issue
Block a user