forked from qt-creator/qt-creator
Always set an environment for QtcProcess
Since e755094480
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 <hjk@qt.io>
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
This commit is contained in:
@@ -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);
|
||||
|
Reference in New Issue
Block a user