RemoteLinux: Avoid some explicit uses of environment iterators

Task-number: QTCREATORBUG-28357
Change-Id: Ic8eb7592853749a7d511acc9a528059765c4ed75
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
hjk
2023-03-02 12:21:58 +01:00
parent 3d45683edf
commit 21de068c14
2 changed files with 6 additions and 7 deletions

View File

@@ -613,8 +613,9 @@ QString LinuxProcessInterface::fullCommandLine(const CommandLine &commandLine) c
cmd.addArgs(QString("echo ") + s_pidMarker + "$$" + s_pidMarker + " && ", CommandLine::Raw);
const Environment &env = m_setup.m_environment;
for (auto it = env.constBegin(); it != env.constEnd(); ++it)
cmd.addArgs(env.key(it) + "='" + env.expandedValueForKey(env.key(it)) + '\'', CommandLine::Raw);
env.forEachEntry([&](const QString &key, const QString &, bool) {
cmd.addArgs(key + "='" + env.expandedValueForKey(key) + '\'', CommandLine::Raw);
});
if (m_setup.m_terminalMode == TerminalMode::Off)
cmd.addArg("exec");

View File

@@ -172,12 +172,10 @@ bool MakeInstallStep::init()
const MakeInstallCommand cmd = buildSystem()->makeInstallCommand(rootDir);
if (cmd.environment.hasChanges()) {
Environment env = processParameters()->environment();
for (auto it = cmd.environment.constBegin(); it != cmd.environment.constEnd(); ++it) {
if (cmd.environment.isEnabled(it)) {
const QString key = cmd.environment.key(it);
cmd.environment.forEachEntry([&](const QString &key, const QString &, bool enabled) {
if (enabled)
env.set(key, cmd.environment.expandedValueForKey(key));
}
}
});
processParameters()->setEnvironment(env);
}
m_noInstallTarget = false;