Commit 8a9cbffe authored by Oswald Buddenhagen's avatar Oswald Buddenhagen
Browse files

use environment from build config also when starting external processes

this uses QProcessEnvironment directly, which is somewhat inefficient,
but it has no big impact, and it can be optimized on the qt side.

Task-number: QTCREATORBUG-2866
parent 4e91de79
......@@ -895,11 +895,7 @@ ProFileReader *Qt4Project::createProFileReader(Qt4ProFileNode *qt4ProFileNode, Q
Utils::Environment env = bc->environment();
Utils::Environment::const_iterator eit = env.constBegin(), eend = env.constEnd();
for (; eit != eend; ++eit)
#ifdef Q_OS_WIN
m_proFileOption->environment.insert(env.key(eit).toUpper(), env.value(eit));
#else
m_proFileOption->environment.insert(env.key(eit), env.value(eit));
#endif
QStringList args;
if (QMakeStep *qs = bc->qmakeStep())
......
......@@ -48,9 +48,6 @@
#include <QtCore/QString>
#include <QtCore/QStringList>
#include <QtCore/QTextStream>
#ifndef QT_BOOTSTRAPPED
# include <QtCore/QProcess>
#endif
#ifdef PROEVALUATOR_THREAD_SAFE
# include <QtCore/QThreadPool>
#endif
......@@ -168,10 +165,8 @@ void ProFileOption::applyHostMode()
QString ProFileOption::getEnv(const QString &var) const
{
#ifndef QT_BOOTSTRAPPED
if (!environment.isEmpty())
#ifdef Q_OS_WIN
return environment.value(var.toUpper());
#else
return environment.value(var);
#endif
return QString::fromLocal8Bit(qgetenv(var.toLocal8Bit().constData()));
......@@ -1538,6 +1533,8 @@ void ProFileEvaluator::Private::runProcess(QProcess *proc, const QString &comman
QProcess::ProcessChannel chan) const
{
proc->setWorkingDirectory(currentDirectory());
if (!m_option->environment.isEmpty())
proc->setProcessEnvironment(m_option->environment);
# ifdef Q_OS_WIN
proc->setNativeArguments(QLatin1String("/v:off /s /c \"") + command + QLatin1Char('"'));
proc->start(m_option->getEnv(QLatin1String("COMSPEC")), QStringList());
......
......@@ -37,6 +37,9 @@
#include <QtCore/QHash>
#include <QtCore/QStringList>
#ifndef QT_BOOTSTRAPPED
# include <QtCore/QProcess>
#endif
#ifdef PROEVALUATOR_THREAD_SAFE
# include <QtCore/QMutex>
# include <QtCore/QWaitCondition>
......@@ -168,7 +171,9 @@ struct ProFileOption
QString qmakespec;
QString cachefile;
QHash<QString, QString> properties;
QHash<QString, QString> environment;
#ifndef QT_BOOTSTRAPPED
QProcessEnvironment environment;
#endif
QString sysroot;
//QString pro_ext;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment