forked from qt-creator/qt-creator
Set LC_MESSAGES instead of LC_ALL for parsing the error output
Task-number: QTCREATORBUG-15855 Change-Id: I05aa83acb356840cfdacc92796b190fb8754ada0 Reviewed-by: hjk <hjk@theqtcompany.com> Reviewed-by: Tobias Hunger <tobias.hunger@theqtcompany.com>
This commit is contained in:
@@ -212,6 +212,26 @@ Environment Environment::systemEnvironment()
|
|||||||
return *staticSystemEnvironment();
|
return *staticSystemEnvironment();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const char lcMessages[] = "LC_MESSAGES";
|
||||||
|
const char englishLocale[] = "en_US.utf8";
|
||||||
|
|
||||||
|
void Environment::setupEnglishOutput(Environment *environment)
|
||||||
|
{
|
||||||
|
environment->set(QLatin1String(lcMessages), QLatin1String(englishLocale));
|
||||||
|
}
|
||||||
|
|
||||||
|
void Environment::setupEnglishOutput(QProcessEnvironment *environment)
|
||||||
|
{
|
||||||
|
environment->insert(QLatin1String(lcMessages), QLatin1String(englishLocale));
|
||||||
|
}
|
||||||
|
|
||||||
|
void Environment::setupEnglishOutput(QStringList *environment)
|
||||||
|
{
|
||||||
|
Environment env(*environment);
|
||||||
|
setupEnglishOutput(&env);
|
||||||
|
*environment = env.toStringList();
|
||||||
|
}
|
||||||
|
|
||||||
void Environment::clear()
|
void Environment::clear()
|
||||||
{
|
{
|
||||||
m_values.clear();
|
m_values.clear();
|
||||||
|
|||||||
@@ -65,6 +65,9 @@ public:
|
|||||||
explicit Environment(OsType osType = HostOsInfo::hostOs()) : m_osType(osType) {}
|
explicit Environment(OsType osType = HostOsInfo::hostOs()) : m_osType(osType) {}
|
||||||
explicit Environment(const QStringList &env, OsType osType = HostOsInfo::hostOs());
|
explicit Environment(const QStringList &env, OsType osType = HostOsInfo::hostOs());
|
||||||
static Environment systemEnvironment();
|
static Environment systemEnvironment();
|
||||||
|
static void setupEnglishOutput(Environment *environment);
|
||||||
|
static void setupEnglishOutput(QProcessEnvironment *environment);
|
||||||
|
static void setupEnglishOutput(QStringList *environment);
|
||||||
|
|
||||||
QStringList toStringList() const;
|
QStringList toStringList() const;
|
||||||
QProcessEnvironment toProcessEnvironment() const;
|
QProcessEnvironment toProcessEnvironment() const;
|
||||||
|
|||||||
@@ -174,9 +174,7 @@ bool MakeStep::init(QList<const BuildStep *> &earlierSteps)
|
|||||||
ProcessParameters *pp = processParameters();
|
ProcessParameters *pp = processParameters();
|
||||||
pp->setMacroExpander(bc->macroExpander());
|
pp->setMacroExpander(bc->macroExpander());
|
||||||
Utils::Environment env = bc->environment();
|
Utils::Environment env = bc->environment();
|
||||||
// Force output to english for the parsers. Do this here and not in the toolchain's
|
Utils::Environment::setupEnglishOutput(&env);
|
||||||
// addToEnvironment() to not screw up the users run environment.
|
|
||||||
env.set(QLatin1String("LC_ALL"), QLatin1String("C"));
|
|
||||||
pp->setEnvironment(env);
|
pp->setEnvironment(env);
|
||||||
pp->setWorkingDirectory(bc->buildDirectory().toString());
|
pp->setWorkingDirectory(bc->buildDirectory().toString());
|
||||||
pp->setCommand(tc ? tc->makeCommand(bc->environment()) : QLatin1String("make"));
|
pp->setCommand(tc ? tc->makeCommand(bc->environment()) : QLatin1String("make"));
|
||||||
|
|||||||
@@ -203,9 +203,7 @@ bool CMakeBuildStep::init(QList<const BuildStep *> &earlierSteps)
|
|||||||
ProcessParameters *pp = processParameters();
|
ProcessParameters *pp = processParameters();
|
||||||
pp->setMacroExpander(bc->macroExpander());
|
pp->setMacroExpander(bc->macroExpander());
|
||||||
Utils::Environment env = bc->environment();
|
Utils::Environment env = bc->environment();
|
||||||
// Force output to english for the parsers. Do this here and not in the toolchain's
|
Utils::Environment::setupEnglishOutput(&env);
|
||||||
// addToEnvironment() to not screw up the users run environment.
|
|
||||||
env.set(QLatin1String("LC_ALL"), QLatin1String("C"));
|
|
||||||
if (!env.value(QLatin1String("NINJA_STATUS")).startsWith(m_ninjaProgressString))
|
if (!env.value(QLatin1String("NINJA_STATUS")).startsWith(m_ninjaProgressString))
|
||||||
env.set(QLatin1String("NINJA_STATUS"), m_ninjaProgressString + QLatin1String("%o/sec] "));
|
env.set(QLatin1String("NINJA_STATUS"), m_ninjaProgressString + QLatin1String("%o/sec] "));
|
||||||
pp->setEnvironment(env);
|
pp->setEnvironment(env);
|
||||||
|
|||||||
@@ -105,7 +105,7 @@ Utils::SynchronousProcessResponse CMakeTool::run(const QString &arg) const
|
|||||||
cmake.setTimeoutS(1);
|
cmake.setTimeoutS(1);
|
||||||
cmake.setFlags(Utils::SynchronousProcess::UnixTerminalDisabled);
|
cmake.setFlags(Utils::SynchronousProcess::UnixTerminalDisabled);
|
||||||
Utils::Environment env = Utils::Environment::systemEnvironment();
|
Utils::Environment env = Utils::Environment::systemEnvironment();
|
||||||
env.set(QLatin1String("LC_ALL"), QLatin1String("C"));
|
Utils::Environment::setupEnglishOutput(&env);
|
||||||
cmake.setProcessEnvironment(env.toProcessEnvironment());
|
cmake.setProcessEnvironment(env.toProcessEnvironment());
|
||||||
cmake.setTimeOutMessageBoxEnabled(false);
|
cmake.setTimeOutMessageBoxEnabled(false);
|
||||||
|
|
||||||
|
|||||||
@@ -27,6 +27,7 @@
|
|||||||
#include "messagemanager.h"
|
#include "messagemanager.h"
|
||||||
#include "icore.h"
|
#include "icore.h"
|
||||||
#include <utils/synchronousprocess.h>
|
#include <utils/synchronousprocess.h>
|
||||||
|
#include <utils/environment.h>
|
||||||
|
|
||||||
#include <QProcess>
|
#include <QProcess>
|
||||||
#include <QProcessEnvironment>
|
#include <QProcessEnvironment>
|
||||||
@@ -91,7 +92,7 @@ static bool runPatchHelper(const QByteArray &input, const QString &workingDirect
|
|||||||
if (!workingDirectory.isEmpty())
|
if (!workingDirectory.isEmpty())
|
||||||
patchProcess.setWorkingDirectory(workingDirectory);
|
patchProcess.setWorkingDirectory(workingDirectory);
|
||||||
QProcessEnvironment env = QProcessEnvironment::systemEnvironment();
|
QProcessEnvironment env = QProcessEnvironment::systemEnvironment();
|
||||||
env.insert(QLatin1String("LC_ALL"), QLatin1String("C"));
|
Utils::Environment::setupEnglishOutput(&env);
|
||||||
patchProcess.setProcessEnvironment(env);
|
patchProcess.setProcessEnvironment(env);
|
||||||
QStringList args;
|
QStringList args;
|
||||||
// Add argument 'apply' when git is used as patch command since git 2.5/Windows
|
// Add argument 'apply' when git is used as patch command since git 2.5/Windows
|
||||||
|
|||||||
@@ -137,7 +137,7 @@ GdbCoreEngine::readExecutableNameFromCore(const QString &debuggerCommand, const
|
|||||||
|
|
||||||
QProcess proc;
|
QProcess proc;
|
||||||
QStringList envLang = QProcess::systemEnvironment();
|
QStringList envLang = QProcess::systemEnvironment();
|
||||||
envLang.replaceInStrings(QRegExp(QLatin1String("^LC_ALL=.*")), QLatin1String("LC_ALL=C"));
|
Utils::Environment::setupEnglishOutput(&envLang);
|
||||||
proc.setEnvironment(envLang);
|
proc.setEnvironment(envLang);
|
||||||
proc.start(debuggerCommand, args);
|
proc.start(debuggerCommand, args);
|
||||||
|
|
||||||
|
|||||||
@@ -108,9 +108,7 @@ bool GenericMakeStep::init(QList<const BuildStep *> &earlierSteps)
|
|||||||
pp->setMacroExpander(bc->macroExpander());
|
pp->setMacroExpander(bc->macroExpander());
|
||||||
pp->setWorkingDirectory(bc->buildDirectory().toString());
|
pp->setWorkingDirectory(bc->buildDirectory().toString());
|
||||||
Utils::Environment env = bc->environment();
|
Utils::Environment env = bc->environment();
|
||||||
// Force output to english for the parsers. Do this here and not in the toolchain's
|
Utils::Environment::setupEnglishOutput(&env);
|
||||||
// addToEnvironment() to not screw up the users run environment.
|
|
||||||
env.set(QLatin1String("LC_ALL"), QLatin1String("C"));
|
|
||||||
pp->setEnvironment(env);
|
pp->setEnvironment(env);
|
||||||
pp->setCommand(makeCommand(bc->environment()));
|
pp->setCommand(makeCommand(bc->environment()));
|
||||||
pp->setArguments(allArguments());
|
pp->setArguments(allArguments());
|
||||||
|
|||||||
@@ -111,9 +111,7 @@ bool IosBuildStep::init(QList<const BuildStep *> &earlierSteps)
|
|||||||
pp->setMacroExpander(bc->macroExpander());
|
pp->setMacroExpander(bc->macroExpander());
|
||||||
pp->setWorkingDirectory(bc->buildDirectory().toString());
|
pp->setWorkingDirectory(bc->buildDirectory().toString());
|
||||||
Utils::Environment env = bc->environment();
|
Utils::Environment env = bc->environment();
|
||||||
// Force output to english for the parsers. Do this here and not in the toolchain's
|
Utils::Environment::setupEnglishOutput(&env);
|
||||||
// addToEnvironment() to not screw up the users run environment.
|
|
||||||
env.set(QLatin1String("LC_ALL"), QLatin1String("C"));
|
|
||||||
pp->setEnvironment(env);
|
pp->setEnvironment(env);
|
||||||
pp->setCommand(buildCommand());
|
pp->setCommand(buildCommand());
|
||||||
pp->setArguments(Utils::QtcProcess::joinArgs(allArguments()));
|
pp->setArguments(Utils::QtcProcess::joinArgs(allArguments()));
|
||||||
|
|||||||
@@ -90,9 +90,7 @@ bool IosPresetBuildStep::init(QList<const BuildStep *> &earlierSteps)
|
|||||||
pp->setMacroExpander(bc->macroExpander());
|
pp->setMacroExpander(bc->macroExpander());
|
||||||
pp->setWorkingDirectory(bc->buildDirectory().toString());
|
pp->setWorkingDirectory(bc->buildDirectory().toString());
|
||||||
Utils::Environment env = bc->environment();
|
Utils::Environment env = bc->environment();
|
||||||
// Force output to english for the parsers. Do this here and not in the toolchain's
|
Utils::Environment::setupEnglishOutput(&env);
|
||||||
// addToEnvironment() to not screw up the users run environment.
|
|
||||||
env.set(QLatin1String("LC_ALL"), QLatin1String("C"));
|
|
||||||
pp->setEnvironment(env);
|
pp->setEnvironment(env);
|
||||||
pp->setCommand(command());
|
pp->setCommand(command());
|
||||||
pp->setArguments(Utils::QtcProcess::joinArgs(arguments()));
|
pp->setArguments(Utils::QtcProcess::joinArgs(arguments()));
|
||||||
|
|||||||
@@ -71,9 +71,8 @@ static QByteArray runGcc(const FileName &gcc, const QStringList &arguments, cons
|
|||||||
return QByteArray();
|
return QByteArray();
|
||||||
|
|
||||||
QProcess cpp;
|
QProcess cpp;
|
||||||
// Force locale: This function is used only to detect settings inside the tool chain, so this is save.
|
|
||||||
QStringList environment(env);
|
QStringList environment(env);
|
||||||
environment.append(QLatin1String("LC_ALL=C"));
|
Utils::Environment::setupEnglishOutput(&environment);
|
||||||
|
|
||||||
cpp.setEnvironment(environment);
|
cpp.setEnvironment(environment);
|
||||||
cpp.start(gcc.toString(), arguments);
|
cpp.start(gcc.toString(), arguments);
|
||||||
|
|||||||
@@ -71,9 +71,7 @@ bool AndroidPackageInstallationStep::init(QList<const BuildStep *> &earlierSteps
|
|||||||
pp->setWorkingDirectory(bc->buildDirectory().toString());
|
pp->setWorkingDirectory(bc->buildDirectory().toString());
|
||||||
pp->setCommand(tc->makeCommand(bc->environment()));
|
pp->setCommand(tc->makeCommand(bc->environment()));
|
||||||
Utils::Environment env = bc->environment();
|
Utils::Environment env = bc->environment();
|
||||||
// Force output to english for the parsers. Do this here and not in the toolchain's
|
Utils::Environment::setupEnglishOutput(&env);
|
||||||
// addToEnvironment() to not screw up the users run environment.
|
|
||||||
env.set(QLatin1String("LC_ALL"), QLatin1String("C"));
|
|
||||||
pp->setEnvironment(env);
|
pp->setEnvironment(env);
|
||||||
const QString innerQuoted = Utils::QtcProcess::quoteArg(dirPath);
|
const QString innerQuoted = Utils::QtcProcess::quoteArg(dirPath);
|
||||||
const QString outerQuoted = Utils::QtcProcess::quoteArg(QString::fromLatin1("INSTALL_ROOT=") + innerQuoted);
|
const QString outerQuoted = Utils::QtcProcess::quoteArg(QString::fromLatin1("INSTALL_ROOT=") + innerQuoted);
|
||||||
|
|||||||
@@ -233,9 +233,7 @@ bool MakeStep::init(QList<const BuildStep *> &earlierSteps)
|
|||||||
Utils::QtcProcess::addArg(&args, objectFile);
|
Utils::QtcProcess::addArg(&args, objectFile);
|
||||||
}
|
}
|
||||||
Utils::Environment env = bc->environment();
|
Utils::Environment env = bc->environment();
|
||||||
// Force output to english for the parsers. Do this here and not in the toolchain's
|
Utils::Environment::setupEnglishOutput(&env);
|
||||||
// addToEnvironment() to not screw up the users run environment.
|
|
||||||
env.set(QLatin1String("LC_ALL"), QLatin1String("C"));
|
|
||||||
// We also prepend "L" to the MAKEFLAGS, so that nmake / jom are less verbose
|
// We also prepend "L" to the MAKEFLAGS, so that nmake / jom are less verbose
|
||||||
if (tc && m_makeCmd.isEmpty()) {
|
if (tc && m_makeCmd.isEmpty()) {
|
||||||
if (tc->targetAbi().os() == Abi::WindowsOS
|
if (tc->targetAbi().os() == Abi::WindowsOS
|
||||||
@@ -415,9 +413,7 @@ void MakeStepConfigWidget::updateDetails()
|
|||||||
QString args = m_makeStep->userArguments();
|
QString args = m_makeStep->userArguments();
|
||||||
|
|
||||||
Utils::Environment env = bc->environment();
|
Utils::Environment env = bc->environment();
|
||||||
// Force output to english for the parsers. Do this here and not in the toolchain's
|
Utils::Environment::setupEnglishOutput(&env);
|
||||||
// addToEnvironment() to not screw up the users run environment.
|
|
||||||
env.set(QLatin1String("LC_ALL"), QLatin1String("C"));
|
|
||||||
// We prepend "L" to the MAKEFLAGS, so that nmake / jom are less verbose
|
// We prepend "L" to the MAKEFLAGS, so that nmake / jom are less verbose
|
||||||
// FIXME doing this without the user having a way to override this is rather bad
|
// FIXME doing this without the user having a way to override this is rather bad
|
||||||
if (tc && m_makeStep->makeCommand().isEmpty()) {
|
if (tc && m_makeStep->makeCommand().isEmpty()) {
|
||||||
|
|||||||
Reference in New Issue
Block a user