From e465d182151f12885fd2c977563587da2eb40877 Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Fri, 27 Aug 2021 10:08:07 +0200 Subject: [PATCH] Always set an environment for QtcProcess Since e755094480b1775c2b7b794766a8170ae03c85f6 we have a global option in Qt Creator to set the (base) environment for any tools run by Qt Creator. So it is expected that any tool actually uses Environment::systemEnvironment() as a base, which is the system environment modified by the global option. QtcProcess already had a fallback to Environment::systemEnvironment for resolving environment variables in Qt Creator macros in the command line. Also use it as a fallback for the actual environment for the process. Latest occurrence where the global environment setting was ignored was for starting language servers by our LSP client. Change-Id: Id1a4141326d8ef3239b37d7f3daf21928605ca92 Reviewed-by: hjk Reviewed-by: Jarek Kobus --- src/libs/utils/qtcprocess.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/libs/utils/qtcprocess.cpp b/src/libs/utils/qtcprocess.cpp index fe0945d146e..c739a3f1441 100644 --- a/src/libs/utils/qtcprocess.cpp +++ b/src/libs/utils/qtcprocess.cpp @@ -350,11 +350,10 @@ void QtcProcess::start() qWarning("QtcProcess::start: Empty environment set when running '%s'.", qPrintable(d->m_commandLine.executable().toString())); env = d->m_environment; - - d->m_process->setProcessEnvironment(env.toProcessEnvironment()); } else { env = Environment::systemEnvironment(); } + d->m_process->setProcessEnvironment(env.toProcessEnvironment()); const QString workDir = d->m_workingDirectory.path(); d->m_process->setWorkingDirectory(workDir);